From d3e2ba0d35f9e1a19d79a1a410c27fdfc7ebc39b Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 24 Aug 2023 17:48:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BD=92=E9=9B=86=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/common/constant/BizConst.java | 2 +- .../controller/GovProjectCollectionController.java | 10 ++++++++- .../gov/manage/GovProjectCollectionManage.java | 26 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java index 0b5acfe..5e4f337 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java @@ -95,6 +95,6 @@ public interface BizConst { String PROD = "prod"; String SAVE_SUCCESS = "保存成功"; - + String OP_SUCCESS = "操作成功"; String SAVE_FAIL = "保存失败"; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java index e4dfa02..d0c76a8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java @@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; import java.util.List; /** @@ -56,7 +57,14 @@ public class GovProjectCollectionController { @PostMapping("/save") @ApiOperation("项目归集保存") @WebLog("项目归集保存") - public String save(@RequestBody GovBizProjectSaveDTO saveDTO) { + public String save(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) { return collectionManage.save(saveDTO); } + + @PostMapping("/remove/{projId}") + @ApiOperation("项目归集删除") + @WebLog("项目归集删除") + public String remove(@PathVariable String projId) { + return collectionManage.remove(projId); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 887d3c2..b90baae 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -319,6 +319,32 @@ public class GovProjectCollectionManage { return BizConst.SAVE_SUCCESS; } + /** + * 删除项目归集 + * @param projId + * @return + */ + public String remove(String projId) { + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projId) + .last(BizConst.LIMIT_1)); + + VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("项目不存在!"); + + baseinfoService.removeById(baseinfo); + projectApplyService.remove(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId,projId)); + approveService.remove(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId,projId)); + cimplementService.remove(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId,projId)); + mimplementService.remove(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId,projId)); + procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId,projId)); + return BizConst.OP_SUCCESS; + } + private void checkName(String baseProjName, String baseProjId) { VUtils.isTrue(baseinfoService.count(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjName,baseProjName)