| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.common.base.Result; |
| | |
| | | import com.ycl.common.constant.Constants; |
| | | import com.ycl.common.core.domain.BaseEntity; |
| | | import com.ycl.common.core.domain.entity.SysDictData; |
| | | import com.ycl.common.enums.YesOrNo; |
| | | import com.ycl.common.enums.business.FileTypeEnum; |
| | | import com.ycl.common.enums.business.ImportanceTypeEnum; |
| | | import com.ycl.common.enums.business.ProjectCategoryEnum; |
| | |
| | | public boolean checkProjectNameAndIdIsUnique(ProjectInfo entity,Long updateId){ |
| | | QueryWrapper<ProjectInfo> queryWrapper = new QueryWrapper<ProjectInfo>(); |
| | | if (updateId == null) { |
| | | |
| | | queryWrapper.eq("project_name", entity.getProjectName()); |
| | | queryWrapper.eq("deleted",0); |
| | | if (StringUtils.isNotEmpty(entity.getProjectCode())) { |
| | | queryWrapper.eq("project_code", entity.getProjectCode()); |
| | | } |
| | | |
| | | List<ProjectInfo> project = projectInfoMapper.selectList(queryWrapper); |
| | | |
| | | return project == null || project.isEmpty(); |
| | | }else { |
| | | |
| | | List<ProjectInfo> project = projectInfoMapper.checkProjectNameAndIdIsUnique(updateId,entity.getProjectName(),entity.getProjectCode()); |
| | | |
| | | return project == null || project.isEmpty(); |
| | | List<ProjectInfo> list = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .eq(ProjectInfo::getProjectName, entity.getProjectName()) |
| | | .eq(ProjectInfo::getProjectCode, entity.getProjectCode()) |
| | | .list(); |
| | | return list == null || list.isEmpty(); |
| | | } else { |
| | | List<ProjectInfo> list = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .eq(ProjectInfo::getProjectName, entity.getProjectName()) |
| | | .eq(ProjectInfo::getProjectCode, entity.getProjectCode()) |
| | | .ne(ProjectInfo::getId, updateId) |
| | | .list(); |
| | | return list == null || list.isEmpty(); |
| | | } |
| | | |
| | | } |
| | |
| | | if (query.getProjectEndTime() != null) { |
| | | query.setProjectEndTime(DateUtils.getDayEnd(query.getProjectEndTime())); |
| | | } |
| | | if (YesOrNo.YES.getCode().equals(query.getCenter())) { |
| | | query.setProjectPhase("6"); |
| | | } |
| | | // 异常项目暂时返回空 |
| | | if (ProjectCategoryEnum.EXCEPTION.getType().equals(query.getProjectPhase())) { |
| | | if (YesOrNo.YES.getCode().equals(query.getExe())) { |
| | | return Result.ok().data(new ArrayList<>()).total(0); |
| | | } |
| | | Long userId = SecurityUtils.getUserId(); |
| | |
| | | ProjectInfoVO.transform(vo); |
| | | ProjectVO projectVO = new ProjectVO(); |
| | | copyToProjectVO(vo, projectVO); |
| | | List<Long> departmentList = vo.getCompetentDepartmentList(); |
| | | projectVO.setAuditRole(SecurityUtils.isAdmin(SecurityUtils.getUserId()) || (!CollectionUtils.isEmpty(departmentList) && departmentList.contains(SecurityUtils.getDeptId()))); |
| | | String competentDepartment = vo.getCompetentDepartment(); |
| | | projectVO.setAuditRole(SecurityUtils.isAdmin(SecurityUtils.getUserId()) || (StringUtils.isNotEmpty(competentDepartment) && competentDepartment.equals(SecurityUtils.getDeptId()))); |
| | | // 翻译项目阶段 |
| | | String phase = ProjectCategoryEnum.getPhaseByProjectStatus(projectVO.getProjectStatus(), projectVO.getProcessId() != null); |
| | | String phase = ProjectCategoryEnum.getPhaseByProjectStatus(projectVO.getProjectPhase()); |
| | | projectVO.setProjectPhase(phase); |
| | | if (StringUtils.isNotEmpty(projectVO.getProjectSubType())) { |
| | | // 翻译项目子类型 |
| | |
| | | ProjectInfo entity = baseMapper.getById(id); |
| | | Assert.notNull(entity, "记录不存在"); |
| | | ProjectInfoVO vo = ProjectInfoVO.getVoByEntity(entity, null); |
| | | List<Long> departmentList = vo.getCompetentDepartmentList(); |
| | | vo.setAuditRole(SecurityUtils.isAdmin(SecurityUtils.getUserId()) || (!CollectionUtils.isEmpty(departmentList) && departmentList.contains(SecurityUtils.getDeptId()))); |
| | | String competentDepartment = vo.getCompetentDepartment(); |
| | | vo.setAuditRole(SecurityUtils.isAdmin(SecurityUtils.getUserId()) || (StringUtils.isNotEmpty(competentDepartment) && competentDepartment.equals(SecurityUtils.getDeptId()))); |
| | | QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); |
| | | fileQueryWrapper.eq("type", FileTypeEnum.PROJECT_INFO.getType()); |
| | | fileQueryWrapper.eq("bus_id", vo.getId()); |
| | |
| | | List<ProjectVO> city = new ArrayList<>(); |
| | | List<ProjectVO> county = new ArrayList<>(); |
| | | projectVOS.forEach(item -> { |
| | | if (ProjectCategoryEnum.RESERVE.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(), item.getProcessId() != null))) { |
| | | if (ProjectCategoryEnum.RESERVE.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectPhase()))) { |
| | | reserve.add(item); |
| | | } else if (ProjectCategoryEnum.PREVIOUS.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(), item.getProcessId() != null))) { |
| | | } else if (ProjectCategoryEnum.PREVIOUS.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectPhase()))) { |
| | | previous.add(item); |
| | | } else if (ProjectCategoryEnum.IMPLEMENT.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(), item.getProcessId() != null))) { |
| | | } else if (ProjectCategoryEnum.IMPLEMENT.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectPhase()))) { |
| | | implement.add(item); |
| | | } else if (ProjectCategoryEnum.FINISH.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(), item.getProcessId() != null))) { |
| | | } else if (ProjectCategoryEnum.FINISH.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectPhase()))) { |
| | | finish.add(item); |
| | | } |
| | | |
| | | if (ImportanceTypeEnum.PROVINCIAL_KEY.getType().equals(item.getImportanceType())) { |
| | | province.add(item); |
| | | } else if (ImportanceTypeEnum.SUINING_KEY.getType().equals(item.getImportanceType())) { |
| | | city.add(item); |
| | | } else if (ImportanceTypeEnum.SHEHONG_KEY.getType().equals(item.getImportanceType())) { |
| | | county.add(item); |
| | | } else // if (ImportanceTypeEnum.NORMAL.getType().equals(item.getImportanceType())) |
| | | { |
| | | if (StringUtils.isBlank(item.getImportanceType())) { |
| | | normal.add(item); |
| | | // 使用contains,因为重点分类可多选,使用,分割存储的 |
| | | } else { |
| | | if (item.getImportanceType().contains(ImportanceTypeEnum.PROVINCIAL_KEY.getType())) { |
| | | province.add(item); |
| | | } |
| | | if (item.getImportanceType().contains(ImportanceTypeEnum.SUINING_KEY.getType())) { |
| | | city.add(item); |
| | | } |
| | | if (item.getImportanceType().contains(ImportanceTypeEnum.SHEHONG_KEY.getType())) { |
| | | county.add(item); |
| | | } |
| | | if (item.getImportanceType().contains(ImportanceTypeEnum.NORMAL.getType())) { |
| | | normal.add(item); |
| | | } |
| | | } |
| | | }); |
| | | //单位先默认为元 |
| | |
| | | ProjectExcelTemplate excel = new ProjectExcelTemplate(); |
| | | BeanUtils.copyProperties(item, excel); |
| | | //项目阶段 |
| | | excel.setProjectPhase(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(), item.getProcessId() != null)); |
| | | excel.setProjectPhase(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectPhase())); |
| | | excelList.add(excel); |
| | | }); |
| | | Set<Integer> indexes = OutputExcelUtils.getSelectFields(query.getFieldList(), ProjectExcelTemplate.class); |
| | |
| | | entity.setCreateBy(userId); |
| | | entity.setUpdateBy(userId); |
| | | //如果是储备项目(未开工项目)不需要审核 |
| | | if ("0".equals(entity.getProjectPhase())) { |
| | | if (ProjectCategoryEnum.RESERVE.getType().equals(entity.getProjectPhase())) { |
| | | entity.setUsedStatus(ProjectConstant.PASS); |
| | | } |
| | | // 管理员修改的直接通过 |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | entity.setUpdateBy(userId); |
| | | //如果是储备项目(未开工项目)不需要审核 |
| | | if (ProjectConstant.COMMIT.equals(entity.getUsedStatus()) && ProjectStatusEnum.PENDDING.getType().equals(entity.getProjectStatus())) { |
| | | if (ProjectCategoryEnum.RESERVE.getType().equals(entity.getProjectPhase())) { |
| | | entity.setUsedStatus(ProjectConstant.PASS); |
| | | } |
| | | // 管理员修改的直接通过 |