Просмотр исходного кода

debug 运维项目

tags/24080901
PoffyZhang 1 год назад
Родитель
Сommit
b4ed7f23a3
5 измененных файлов: 140 добавлений и 1 удалений
  1. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java
  2. +129
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  3. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java
  4. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectDraft.java
  5. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java Просмотреть файл

@@ -179,4 +179,11 @@ public class GovProjectCollectionController {
public String stagingConvertPdf3(@RequestBody List<String> projIds) {
return collectionManage.rebuildProjectCode(projIds);
}

@PostMapping("/remove-project")
@ApiOperation("删除申报项目")
@WebLog("删除申报项目")
public String removeProject(@RequestBody List<String> projectCodes){
return collectionManage.removeProject(projectCodes);
}
}

+ 129
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java Просмотреть файл

@@ -26,20 +26,41 @@ import com.ningdatech.pmapi.gov.model.req.ProjectBaseInfoReq;
import com.ningdatech.pmapi.gov.model.req.ProjectPushReq;
import com.ningdatech.pmapi.gov.model.vo.*;
import com.ningdatech.pmapi.gov.service.*;
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag;
import com.ningdatech.pmapi.portrait.service.IProjectTagService;
import com.ningdatech.pmapi.projectdeclared.model.entity.Operation;
import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson;
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;
import com.ningdatech.pmapi.projectdeclared.service.IOperationService;
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService;
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService;
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum;
import com.ningdatech.pmapi.projectlib.model.entity.*;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.service.*;
import com.ningdatech.pmapi.provincial.manage.ProvincialManage;
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo;
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification;
import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService;
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService;
import com.ningdatech.pmapi.staging.model.entity.ProjectStaging;
import com.ningdatech.pmapi.staging.service.IProjectStagingService;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.ningdatech.pmapi.wps.manage.WpsConvertManage;
import com.wflow.bean.entity.WflowCcTasks;
import com.wflow.service.WflowCcTasksService;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -114,6 +135,33 @@ public class GovProjectCollectionManage {

private final RegionCacheHelper regionCacheHelper;

private final IProjectService projectService;
private final IProjectApplicationService applicationService;

private final IProjectInstService projectInstService;

private final RuntimeService runtimeService;

private final HistoryService historyService;

private final WflowCcTasksService ccTasksService;

private final IOperationService operationService;

private final IProjectRenewalFundDeclarationService renewalFundDeclarationService;

private final IProjectStagingService stagingService;

private final INdProjectStatusChangeService statusChangeService;

private final IPurchaseService purchaseService;

private final IProjectTagService projectTagService;

private final ISupplierSafetyQualificationService supplierSafetyQualificationService;
private final IPreInsAcceptancePersonService preInsAcceptancePersonService;
private final IPersonSafetyInfoService personService;

public List<GovProjectDictionaryVO> dictionary(String type) {

List<GovProjectDictionary> dictionaries = dictionaryService.list(Wrappers.lambdaQuery(GovProjectDictionary.class)
@@ -1759,4 +1807,85 @@ public class GovProjectCollectionManage {
}
return "运行成功 重新生成" + baseProjIds.size() + "个项目编号";
}

public String removeProject(List<String> projectCodes) {
if(CollUtil.isEmpty(projectCodes)){
throw new BizException("项目编号不能为空!");
}

for(String projectCode : projectCodes){
//项目
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, projectCode));

List<Long> projectIds = projects.stream().map(Project::getId).collect(Collectors.toList());

//1.删除应用
applicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,projectCode));

//2.删除相关流程
List<ProjectInst> projectInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIds));
for(ProjectInst projectInst : projectInsts){
//实例
try{
runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除");
}catch (Exception e){

}
try{
historyService.deleteHistoricProcessInstance(projectInst.getInstCode());
}catch (Exception e){

}
//抄送
ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class)
.eq(WflowCcTasks::getInstanceId,projectInst.getInstCode()));
}
projectInstService.removeByIds(projectInsts.stream().map(ProjectInst::getId).collect(Collectors.toList()));

//3.删除实施表
operationService.remove(Wrappers.lambdaQuery(Operation.class)
.eq(Operation::getProjectCode,projectCode));

//4.删除续建项目资金表
renewalFundDeclarationService.remove(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getProjectCode,projectCode));

//5.暂存表
stagingService.remove(Wrappers.lambdaQuery(ProjectStaging.class)
.in(ProjectStaging::getProjectId,projectIds));

//6.状态变更表
statusChangeService.remove(Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectId,projectIds));

//7.采购表
purchaseService.remove(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId,projectIds));

//8.标签
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class)
.eq(ProjectTag::getProjectCode,projectCode));

//9.初验人员
preInsAcceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.in(PreInsAcceptancePerson::getProjectId,projectIds));

//10.供应商安全质量
supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode,projectCode));

//11.安全人员
personService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode,projectCode));

//12.最后删除项目
projectService.remove(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, projectCode));
}
return "删除成功";
}

}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java Просмотреть файл

@@ -101,4 +101,6 @@ public class GovOperationProjectBaseinfoDTO implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;


}

+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectDraft.java Просмотреть файл

@@ -26,6 +26,7 @@ public class GovOperationProjectDraft implements Serializable {
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
private Boolean push;
private String baseProjId;
private String baseProjName;
private String baseAreaName;


+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java Просмотреть файл

@@ -109,7 +109,7 @@ public class ProjectRemoveTest extends AppTests {

@Test
public void test(){
List<String> projectCodes = Lists.newArrayList("33112600020230100002");
List<String> projectCodes = Lists.newArrayList("33112100020230100002");

for(String projectCode : projectCodes){
//项目


Загрузка…
Отмена
Сохранить