From b7856b41fb1825e7d37a2d3e7d27957e7acaf483 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 8 Sep 2023 18:01:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E5=BC=82=E6=AD=A5=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectCollection/ProjectCollectionTest.java | 57 ++++++++++++---------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java index e4c5398..044249c 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.projectCollection; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; @@ -12,6 +13,9 @@ import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import java.util.ArrayList; +import java.util.List; + /** * @Classname ProjectCollectionTest * @Description @@ -43,33 +47,36 @@ public class ProjectCollectionTest extends AppTests { @Test public void test(){ - String baseProjId = "33112500020210100003"; - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)); - GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId)); + List baseProjIds = Lists.newArrayList("33112720210100190","33112620230100053", + "33112620210100189","33112720210100188"); + for(String baseProjId : baseProjIds){ + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)); + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId)); - GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); - saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); - saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); - String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + 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); - applyService.updateById(apply); - approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,baseProjId) - .set(GovBizProjectApprove::getBaseProjId,newProjId)); - cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId,baseProjId) - .set(GovBizProjectCimplement::getBaseProjId,newProjId)); - mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId,baseProjId) - .set(GovBizProjectMimplement::getBaseProjId,newProjId)); - procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,baseProjId) - .set(GovBizProjectProcure::getBaseProjId,newProjId)); + baseinfo.setBaseProjId(newProjId); + baseinfoService.updateById(baseinfo); + apply.setBaseProjId(newProjId); + applyService.updateById(apply); + approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId,baseProjId) + .set(GovBizProjectApprove::getBaseProjId,newProjId)); + cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId,baseProjId) + .set(GovBizProjectCimplement::getBaseProjId,newProjId)); + mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId,baseProjId) + .set(GovBizProjectMimplement::getBaseProjId,newProjId)); + procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId,baseProjId) + .set(GovBizProjectProcure::getBaseProjId,newProjId)); + } } }