瀏覽代碼

运维备案 支持重新生成

tags/24080901
PoffyZhang 1 年之前
父節點
當前提交
dae4db08cd
共有 1 個檔案被更改,包括 135 行新增48 行删除
  1. +135
    -48
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java

+ 135
- 48
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java 查看文件

@@ -1787,69 +1787,156 @@ public class GovProjectCollectionManage {
if(CollUtil.isEmpty(baseProjIds)){
throw new BizException("项目编号不能为空");
}
Integer successNum = 0;
for(String baseProjId : baseProjIds){
//两种情况
//1.项目归集
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectBaseinfo::getTongTime)
.last(BizConst.LIMIT_1));
GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApply::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.isNull(baseinfo)){
System.out.println("项目不存在 直接下一个");
continue;
if(Objects.nonNull(baseinfo)){
rebuildGuiji(baseProjId);
successNum ++;
}
GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO();
saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class));
saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class));
String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO);

baseinfo.setBaseProjId(newProjId);
baseinfoService.updateById(baseinfo);
apply.setBaseProjId(newProjId);
projectApplyService.updateById(apply);

GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApprove::getTongTime)
//2.运维备案
GovOperationProjectBaseinfo operation = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class)
.eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId)
.orderByDesc(GovOperationProjectBaseinfo::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(approve)){
approve.setBaseProjId(newProjId);
approveService.updateById(approve);
if(Objects.nonNull(operation)){
rebuildOperation(baseProjId);
successNum ++;
}
}
return "运行成功 重新生成" + successNum + "个项目编号";
}

private void rebuildGuiji(String baseProjId) {
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectBaseinfo::getTongTime)
.last(BizConst.LIMIT_1));
GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApply::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.isNull(baseinfo)){
System.out.println("项目不存在 直接下一个");
return;
}
GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO();
saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class));
saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class));
String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO);

GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectCimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(cimplement)){
cimplement.setBaseProjId(newProjId);
cimplement.setBaseBidCode(newProjId);
cimplementService.updateById(cimplement);
}
baseinfo.setBaseProjId(newProjId);
baseinfoService.updateById(baseinfo);
apply.setBaseProjId(newProjId);
projectApplyService.updateById(apply);

GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectMimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(mimplement)){
mimplement.setBaseProjId(newProjId);
mimplement.setBaseBidCode(newProjId);
mimplementService.updateById(mimplement);
}
GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApprove::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(approve)){
approve.setBaseProjId(newProjId);
approveService.updateById(approve);
}

List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId, baseProjId));

for(GovBizProjectProcure procure : procures){
procure.setBaseProjId(newProjId);
procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]);
procureService.updateById(procure);
}
GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectCimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(cimplement)){
cimplement.setBaseProjId(newProjId);
cimplement.setBaseBidCode(newProjId);
cimplementService.updateById(cimplement);
}

GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectMimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(mimplement)){
mimplement.setBaseProjId(newProjId);
mimplement.setBaseBidCode(newProjId);
mimplementService.updateById(mimplement);
}

List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId, baseProjId));

for(GovBizProjectProcure procure : procures){
procure.setBaseProjId(newProjId);
procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]);
procureService.updateById(procure);
}
}

private void rebuildOperation(String baseProjId) {
GovOperationProjectBaseinfo operationBase = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class)
.eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId)
.orderByDesc(GovOperationProjectBaseinfo::getTongTime)
.last(BizConst.LIMIT_1));
GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApply::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.isNull(operationBase)){
System.out.println("运维备案项目不存在 直接下一个");
return;
}
GovOperationProjectSaveDTO saveDTO = new GovOperationProjectSaveDTO();
saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class));
saveDTO.setBaseinfo(BeanUtil.copyProperties(operationBase, GovOperationProjectBaseinfoDTO.class));
String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO);

operationBase.setBaseProjId(newProjId);
operationProjectBaseinfoService.updateById(operationBase);
apply.setBaseProjId(newProjId);
projectApplyService.updateById(apply);

GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApprove::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(approve)){
approve.setBaseProjId(newProjId);
approveService.updateById(approve);
}


GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectCimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(cimplement)){
cimplement.setBaseProjId(newProjId);
cimplement.setBaseBidCode(newProjId);
cimplementService.updateById(cimplement);
}

GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectMimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(mimplement)){
mimplement.setBaseProjId(newProjId);
mimplement.setBaseBidCode(newProjId);
mimplementService.updateById(mimplement);
}

List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId, baseProjId));

for(GovBizProjectProcure procure : procures){
procure.setBaseProjId(newProjId);
procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]);
procureService.updateById(procure);
}
return "运行成功 重新生成" + baseProjIds.size() + "个项目编号";
}

public String removeProject(List<String> projectCodes) {


Loading…
取消
儲存