@@ -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.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; | import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | 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.IProjectRenewalFundDeclarationService; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
@@ -73,10 +74,11 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||||
public class AnnualPlanLibManage { | public class AnnualPlanLibManage { | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final IProjectApplicationService applicationService; | |||||
private final StateMachineUtils stateMachine; | private final StateMachineUtils stateMachine; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; | private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; | ||||
private final ProjectLibManage projectLibManage; | |||||
/** | /** | ||||
* 年度计划查询状态 | * 年度计划查询状态 | ||||
@@ -164,7 +166,7 @@ public class AnnualPlanLibManage { | |||||
project.setProjectCode(oldProject.getProjectCode()); | project.setProjectCode(oldProject.getProjectCode()); | ||||
project.setVersion(oldProject.getVersion() + 1); | project.setVersion(oldProject.getVersion() + 1); | ||||
if(projectService.save(project)){ | if(projectService.save(project)){ | ||||
projectLibManage.saveApplication(project,oldProject,Boolean.TRUE); | |||||
applicationService.saveApplication(project,oldProject,Boolean.TRUE); | |||||
// 将旧的项目版本置为不是最新 | // 将旧的项目版本置为不是最新 | ||||
projectService.update(Wrappers.lambdaUpdate(Project.class) | projectService.update(Wrappers.lambdaUpdate(Project.class) | ||||
.set(Project::getNewest, Boolean.FALSE) | .set(Project::getNewest, Boolean.FALSE) | ||||
@@ -17,4 +17,6 @@ import java.util.List; | |||||
public interface IProjectApplicationService extends IService<ProjectApplication> { | public interface IProjectApplicationService extends IService<ProjectApplication> { | ||||
List<ProjectApplication> getApplicationsByProject(Project project); | List<ProjectApplication> getApplicationsByProject(Project project); | ||||
void saveApplication(Project project,Project oldProject,Boolean isConstruct); | |||||
} | } |
@@ -1,14 +1,20 @@ | |||||
package com.ningdatech.pmapi.projectlib.service.impl; | package com.ningdatech.pmapi.projectlib.service.impl; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 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.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | ||||
import com.ningdatech.pmapi.projectlib.mapper.ProjectApplicationMapper; | import com.ningdatech.pmapi.projectlib.mapper.ProjectApplicationMapper; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
import lombok.AllArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -19,7 +25,14 @@ import java.util.List; | |||||
* @since 2023-02-05 | * @since 2023-02-05 | ||||
*/ | */ | ||||
@Service | @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 | @Override | ||||
public List<ProjectApplication> getApplicationsByProject(Project project) { | public List<ProjectApplication> getApplicationsByProject(Project project) { | ||||
@@ -27,4 +40,34 @@ public class ProjectApplicationServiceImpl extends ServiceImpl<ProjectApplicatio | |||||
.eq(ProjectApplication::getProjectCode, project.getProjectCode())); | .eq(ProjectApplication::getProjectCode, project.getProjectCode())); | ||||
return apps; | 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); | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
} | } |
@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.pmapi.common.constant.BizConst; | 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.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.mapper.ProjectMapper; | import com.ningdatech.pmapi.projectlib.mapper.ProjectMapper; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||