From b3a7dfa2f98198b0d3b8852f96dfb401dbecba48 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 30 Aug 2023 10:12:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E4=BF=A1=E6=81=AF=20?= =?UTF-8?q?=E5=85=A8=E9=87=8F=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov/manage/GovProjectCollectionManage.java | 38 +++++++++------------- .../open/manage/ProjectReceiveManage.java | 24 +++++++------- 2 files changed, 27 insertions(+), 35 deletions(-) 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 75568b0..7a8bf7b 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 @@ -346,32 +346,26 @@ public class GovProjectCollectionManage { // 6.保存 采购信息 List procures = saveDTO.getProcures(); Integer index = 1; - for(GovBizProjectProcureDTO procure : procures){ - procure.setBaseProjId(baseProjId); - procure.setBaseProjName(baseProjName); - procure.setBaseBidCode(baseProjId + StrPool.DASH + index); - - GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); - saveProcure.setBaseProjId(baseProjId); - - if(Objects.nonNull(saveBase.getAreaCode())){ - saveProcure.setAreaCode(saveBase.getAreaCode()); - } - if(Objects.isNull(procure.getId())){ - saveProcure.setTongTime(LocalDateTime.now()); - }else{ - //如果是修改 那就看下库里是否有 - Long id = saveProcure.getId(); - GovBizProjectProcure old = procureService.getById(id); - if(Objects.isNull(old)){ - saveProcure.setId(null); + if(Objects.nonNull(procures)){ + procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId,baseProjId)); + for(GovBizProjectProcureDTO procure : procures){ + procure.setBaseProjId(baseProjId); + procure.setBaseProjName(baseProjName); + procure.setBaseBidCode(baseProjId + StrPool.DASH + index); + + GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); + saveProcure.setBaseProjId(baseProjId); + saveProcure.setId(null); + if(Objects.nonNull(saveBase.getAreaCode())){ + saveProcure.setAreaCode(saveBase.getAreaCode()); } + saveProcure.setTongTime(LocalDateTime.now()); + procureService.save(saveProcure); + index++; } - procureService.saveOrUpdate(saveProcure); - index++; } - //7. 推送数据 pushProject(saveDTO); diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java index c09fc20..3ca9a7f 100644 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java +++ b/syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java @@ -1,6 +1,7 @@ package com.ningdatech.syndataapi.open.manage; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.function.VUtils; import com.ningdatech.syndataapi.common.constant.BizConst; @@ -129,23 +130,20 @@ public class ProjectReceiveManage { // 6.保存 采购信息 List procures = dto.getProcures(); - for(ProjectProcure procure : procures){ - ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class); - saveProcure.setBaseProjId(baseProjId); - if(Objects.isNull(saveProcure.getTongID())){ + if(Objects.nonNull(procures)){ + procureService.remove(Wrappers.lambdaQuery(ProjectProcure.class) + .eq(ProjectProcure::getBaseProjId,baseProjId)); + for(ProjectProcure procure : procures){ + ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class); + saveProcure.setBaseProjId(baseProjId); + saveProcure.setTongID(null); saveProcure.setTongTime(LocalDateTime.now()); - }else{ - //如果是修改 那就看下库里是否有 - Integer tongId = saveProcure.getTongID(); - ProjectProcure old = procureService.getById(tongId); - if(Objects.isNull(old)){ - saveProcure.setTongID(null); - } + saveProcure.setBizTime(LocalDateTime.now()); + procureService.save(saveProcure); } - saveProcure.setBizTime(LocalDateTime.now()); - procureService.saveOrUpdate(saveProcure); } + return BizConst.SAVE_SUCCESS; }