Procházet zdrojové kódy

Merge branch '20230731_ls2_operation+early_warning+safety_risk+portrait' of http://git.ningdatech.com/liushuai/project-management into dev

master
PoffyZhang před 1 rokem
rodič
revize
d7046792a4
4 změnil soubory, kde provedl 52 přidání a 3 odebrání
  1. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  2. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectApplicationService.java
  3. +44
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectApplicationServiceImpl.java
  4. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectServiceImpl.java

+ 4
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java Zobrazit soubor

@@ -39,6 +39,7 @@ import com.ningdatech.pmapi.projectlib.model.req.ProjectIdReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq;
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
@@ -73,10 +74,11 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*;
public class AnnualPlanLibManage {

private final IProjectService projectService;

private final IProjectApplicationService applicationService;
private final StateMachineUtils stateMachine;
private final UserInfoHelper userInfoHelper;
private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService;
private final ProjectLibManage projectLibManage;

/**
* 年度计划查询状态
@@ -164,7 +166,7 @@ public class AnnualPlanLibManage {
project.setProjectCode(oldProject.getProjectCode());
project.setVersion(oldProject.getVersion() + 1);
if(projectService.save(project)){
projectLibManage.saveApplication(project,oldProject,Boolean.TRUE);
applicationService.saveApplication(project,oldProject,Boolean.TRUE);
// 将旧的项目版本置为不是最新
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectApplicationService.java Zobrazit soubor

@@ -17,4 +17,6 @@ import java.util.List;
public interface IProjectApplicationService extends IService<ProjectApplication> {

List<ProjectApplication> getApplicationsByProject(Project project);

void saveApplication(Project project,Project oldProject,Boolean isConstruct);
}

+ 44
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectApplicationServiceImpl.java Zobrazit soubor

@@ -1,14 +1,20 @@
package com.ningdatech.pmapi.projectlib.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators;
import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.mapper.ProjectApplicationMapper;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
* <p>
@@ -19,7 +25,14 @@ import java.util.List;
* @since 2023-02-05
*/
@Service
public class ProjectApplicationServiceImpl extends ServiceImpl<ProjectApplicationMapper, ProjectApplication> implements IProjectApplicationService {
@Slf4j
@AllArgsConstructor
public class ProjectApplicationServiceImpl extends ServiceImpl<ProjectApplicationMapper, ProjectApplication>
implements IProjectApplicationService {

private final IProjectApplicationService applicationService;

private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService;

@Override
public List<ProjectApplication> getApplicationsByProject(Project project) {
@@ -27,4 +40,34 @@ public class ProjectApplicationServiceImpl extends ServiceImpl<ProjectApplicatio
.eq(ProjectApplication::getProjectCode, project.getProjectCode()));
return apps;
}

@Override
public void saveApplication(Project project,Project oldProject,Boolean isConstruct) {
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode())
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion()));
if(CollUtil.isNotEmpty(apps)){
apps.forEach(app -> {
Long oldAppId = app.getId();
app.setProjectVersion(project.getVersion());
app.setProjectId(project.getId());
app.setId(null);
if(Objects.nonNull(isConstruct)){
app.setIsConstruct(isConstruct);
}
applicationService.save(app);

//核心业务
List<ProjectCoreBusinessIndicators> cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class)
.eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId));
if(CollUtil.isNotEmpty(cores)){
cores.forEach(c -> {
c.setId(null);
c.setApplicationId(app.getId());
projectCoreBusinessIndicatorsService.save(c);
});
}
});
}
}
}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectServiceImpl.java Zobrazit soubor

@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.mapper.ProjectMapper;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


Načítá se…
Zrušit
Uložit