| | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.contract.repository.ContractProjectRepository; |
| | | import me.zhengjie.modules.cost.repository.CostRepository; |
| | | import me.zhengjie.modules.project.domain.*; |
| | | import me.zhengjie.modules.project.repository.*; |
| | | import me.zhengjie.modules.project.service.ProjectCostService; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.domain.SysGoalSetting; |
| | | import me.zhengjie.modules.system.repository.SysGoalSettingRepository; |
| | | import me.zhengjie.modules.system.service.SysGoalSettingService; |
| | | import me.zhengjie.modules.system.service.dto.SysGoalSettingDto; |
| | | import me.zhengjie.modules.system.service.dto.SysGoalSettingQueryCriteria; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskInterface; |
| | |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectCostOther; |
| | | import me.zhengjie.modules.project.domain.ProjectCostSummary; |
| | | import me.zhengjie.modules.project.domain.ProjectTask; |
| | | import me.zhengjie.modules.project.domain.ProjectTaskSummary; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | |
| | | private final ProjectPerformanceDetailRepository projectPerformanceDetailRepository; |
| | | private final CostRepository costRepository; |
| | | private final ContractProjectRepository contractProjectRepository; |
| | | private final SysGoalSettingService sysGoalSettingService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable) { |
| | |
| | | for (int i = 0; i < projectDtoList.size(); i ++) { |
| | | // 项目 |
| | | ProjectDto projectDto = projectDtoList.get(i); |
| | | // 负责人ID列表 |
| | | List<Long> liableUserIdList = new ArrayList<>(); |
| | | // 负责人ID |
| | | String handleLiableUserId = projectDto.getLiableUserId().replace("-", ""); |
| | | // 负责人ID列表 |
| | | String[] handleLiableUserIdList = handleLiableUserId.split(","); |
| | | // 循环负责人ID列表 |
| | | for (String liableUserId : handleLiableUserIdList) { |
| | | |
| | | if (projectDto.getLiableUserId() != null && !"".equals(projectDto.getLiableUserId())) { |
| | | // 负责人ID列表 |
| | | liableUserIdList.add(Long.valueOf(liableUserId)); |
| | | List<Long> liableUserIdList = new ArrayList<>(); |
| | | // 负责人ID |
| | | String handleLiableUserId = projectDto.getLiableUserId().replace("-", ""); |
| | | // 负责人ID列表 |
| | | String[] handleLiableUserIdList = handleLiableUserId.split(","); |
| | | // 循环负责人ID列表 |
| | | for (String liableUserId : handleLiableUserIdList) { |
| | | // 负责人ID列表 |
| | | liableUserIdList.add(Long.valueOf(liableUserId)); |
| | | } |
| | | // 负责人ID列表 |
| | | projectDto.setLiableUserIdList(liableUserIdList); |
| | | } |
| | | // 负责人ID列表 |
| | | projectDto.setLiableUserIdList(liableUserIdList); |
| | | } |
| | | return projectDtoList; |
| | | } |
| | |
| | | String unitCurrency = project.getUnitCurrency() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_UNIT_CURRENCY, project.getUnitCurrency()).getLabel() : ""; |
| | | // 负责人名称 |
| | | String liableUserName = null; |
| | | // 处理后负责人ID |
| | | String handleLiableUserId = project.getLiableUserId().replace("-", ""); |
| | | // 处理后负责人ID列表 |
| | | String[] handleLiableUserIdList = handleLiableUserId.split(","); |
| | | // 循环处理后负责人ID列表 |
| | | for (String liableUserId : handleLiableUserIdList) { |
| | | // 根据负责人ID查询用户信息 |
| | | User user = userRepository.findById(Long.valueOf(liableUserId)).orElseGet(User::new); |
| | | // 判断负责人名称 |
| | | liableUserName = liableUserName == null ? user.getNickName() : liableUserName + "," + user.getNickName(); |
| | | |
| | | if (project.getLiableUserId() != null && !"".equals(project.getLiableUserId())) { |
| | | // 处理后负责人ID |
| | | String handleLiableUserId = project.getLiableUserId().replace("-", ""); |
| | | // 处理后负责人ID列表 |
| | | String[] handleLiableUserIdList = handleLiableUserId.split(","); |
| | | // 循环处理后负责人ID列表 |
| | | for (String liableUserId : handleLiableUserIdList) { |
| | | // 根据负责人ID查询用户信息 |
| | | User user = userRepository.findById(Long.valueOf(liableUserId)).orElseGet(User::new); |
| | | // 判断负责人名称 |
| | | liableUserName = liableUserName == null ? user.getNickName() : liableUserName + "," + user.getNickName(); |
| | | } |
| | | } |
| | | |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | |
| | | criteria.setIdInList(partakeProjectIds); |
| | | return projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> querySubgroupTurnover(ProjectQueryCriteria criteria){ |
| | | // 根据字典名称查询 |
| | | List<DictDetail> dictDetailList = dictDetailRepository.findByDictName(Constant.PROJECT_DISTINGUISH); |
| | | // 根据目标年份查询分组营业额 |
| | | List<ProjectSummary> projectSummaryList = projectRepository.findSubgroupTurnoverByTargetYear(criteria.getTargetYear()); |
| | | // 根据目标年份查询分组目标金额 |
| | | SysGoalSettingQueryCriteria sysGoalSettingQueryCriteria = new SysGoalSettingQueryCriteria(); |
| | | sysGoalSettingQueryCriteria.setTargetYear(criteria.getTargetYear()); |
| | | List<SysGoalSettingDto> sysGoalSettingDtoList = sysGoalSettingService.queryAll(sysGoalSettingQueryCriteria); |
| | | // 返回列表 |
| | | List<Map<String, Object>> returnList = new ArrayList<>(); |
| | | // 循环项目区分 |
| | | for (int i = 0; i < dictDetailList.size(); i ++) { |
| | | // 返回集合 |
| | | Map<String, Object> returnMap = new HashMap<>(); |
| | | // 当前项目区分 |
| | | DictDetail dictDetail = dictDetailList.get(i); |
| | | // 返回集合 |
| | | returnMap.put("projectDistinguish", dictDetail.getLabel()); |
| | | // 循环分组营业额 |
| | | for (int j = 0; j < projectSummaryList.size(); j ++) { |
| | | // 判断与项目区分是否一致 |
| | | if (dictDetail.getValue().equals(projectSummaryList.get(j).getProjectDistinguish())) { |
| | | // 返回集合 |
| | | returnMap.put("contractPrice", projectSummaryList.get(j).getContractPrice()); |
| | | break; |
| | | } |
| | | // 判断循环是否结束 |
| | | if (j == projectSummaryList.size() - 1) { |
| | | // 返回集合 |
| | | returnMap.put("contractPrice", new BigDecimal(0)); |
| | | } |
| | | } |
| | | // 循环分组目标金额 |
| | | for (int j = 0; j < sysGoalSettingDtoList.size(); j ++) { |
| | | // 判断与项目区分是否一致 |
| | | if (dictDetail.getValue().equals(sysGoalSettingDtoList.get(j).getProjectDistinguish())) { |
| | | // 返回集合 |
| | | returnMap.put("targetAmount", sysGoalSettingDtoList.get(j).getTargetAmount()); |
| | | break; |
| | | } |
| | | // 判断循环是否结束 |
| | | if (j == sysGoalSettingDtoList.size() - 1) { |
| | | // 返回集合 |
| | | returnMap.put("targetAmount", new BigDecimal(0)); |
| | | } |
| | | } |
| | | // 返回列表 |
| | | returnList.add(returnMap); |
| | | } |
| | | return returnList; |
| | | } |
| | | } |