zxl
2025-03-14 23b688e436a89845e92d861adb5875e625e90d9f
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;
@@ -68,6 +69,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;
@@ -153,7 +155,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 +353,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 +369,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 +408,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());