From 1b9936ba920d65df09ab8dba79c6252568ee26e4 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期三, 26 三月 2025 12:16:02 +0800 Subject: [PATCH] 任务统计bug --- business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java index 65c029b..9f8f43a 100644 --- a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java +++ b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java @@ -7,6 +7,7 @@ import cn.hutool.core.util.ZipUtil; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -19,10 +20,7 @@ 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; -import com.ycl.common.enums.business.ProjectStatusEnum; +import com.ycl.common.enums.business.*; import com.ycl.common.exception.base.BaseException; import com.ycl.common.utils.CopyUtils; import com.ycl.common.utils.DateUtils; @@ -68,6 +66,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; +import java.time.Year; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -98,6 +97,7 @@ private final ProjectUnitRegistrationInfoServiceImpl projectUnitRegistrationInfoServiceImpl; private final SysDeptMapper sysDeptMapper; private final ISysDictDataService dictDataService; + private final ProcessLogService processLogService; /** @@ -153,7 +153,7 @@ * @return */ public boolean checkProjectNameAndIdIsUnique(ProjectInfo entity,Long updateId){ - QueryWrapper<ProjectInfo> queryWrapper = new QueryWrapper<ProjectInfo>(); + LambdaQueryWrapper<ProjectInfo> queryWrapper = new LambdaQueryWrapper<>(); if (updateId == null) { List<ProjectInfo> list = new LambdaQueryChainWrapper<>(baseMapper) .eq(ProjectInfo::getProjectName, entity.getProjectName()) @@ -351,12 +351,13 @@ baseMapper.getPage(query, page); List<ProjectInfoVO> records = page.getRecords(); List<ProjectVO> list = new ArrayList<>(); + int year = Year.now().getValue(); records.forEach(vo -> { ProjectInfoVO.transform(vo); ProjectVO projectVO = new ProjectVO(); copyToProjectVO(vo, projectVO); String competentDepartment = vo.getCompetentDepartment(); - projectVO.setAuditRole(SecurityUtils.isAdmin(SecurityUtils.getUserId()) || (StringUtils.isNotEmpty(competentDepartment) && competentDepartment.equals(SecurityUtils.getDeptId()))); + projectVO.setAuditRole(SecurityUtils.isAdmin(SecurityUtils.getUserId()) || (StringUtils.isNotEmpty(competentDepartment) && competentDepartment.equals(SecurityUtils.getDeptId() + ""))); // 缈昏瘧椤圭洰闃舵 String phase = ProjectCategoryEnum.getPhaseByProjectStatus(projectVO.getProjectPhase()); projectVO.setProjectPhase(phase); @@ -366,6 +367,14 @@ if (Objects.nonNull(dictData)) { projectVO.setProjectSubType(dictData.getDictLabel()); } + } + // 鑾峰彇鏈勾搴︾殑鎶曡祫閲戦 + List<ProjectInfoYearPlan> yearPlans = new LambdaQueryChainWrapper<>(projectInfoYearPlanService.getBaseMapper()) + .eq(ProjectInfoYearPlan::getProjectInfoId, projectVO.getId()) + .eq(ProjectInfoYearPlan::getYear, year) + .list(); + if (! CollectionUtils.isEmpty(yearPlans)) { + projectVO.setYearInvestAmount(yearPlans.get(0).getYearTotalMoney()); } list.add(projectVO); }); @@ -397,7 +406,7 @@ Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); ProjectInfoVO vo = ProjectInfoVO.getVoByEntity(entity, null); String competentDepartment = vo.getCompetentDepartment(); - vo.setAuditRole(SecurityUtils.isAdmin(SecurityUtils.getUserId()) || (StringUtils.isNotEmpty(competentDepartment) && competentDepartment.equals(SecurityUtils.getDeptId()))); + 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()); @@ -536,6 +545,12 @@ public Map<String, Integer> countExceptionProject(IndexDTO indexDTO) { Map<String, Integer> map = new HashMap<>(); map.put("processExceptionProject", 0); + // 鏌ヨ鍙戠敓杩囧缂虹殑椤圭洰鏁� + List<String> projectIds = new LambdaQueryChainWrapper<>(processLogService.getBaseMapper()) + .select(ProcessLog::getProjectId) + .eq(ProcessLog::getEventType, ProcessLogEventTypeEnum.WAIT) + .list().stream().map(ProcessLog::getProjectId).distinct().collect(Collectors.toList()); + map.put("hasWaitProjectNum", projectIds.size()); return map; } -- Gitblit v1.8.0