浏览代码

优化 采购信息的异步线程池

tags/24080901
PoffyZhang 1年前
父节点
当前提交
b7856b41fb
共有 1 个文件被更改,包括 32 次插入25 次删除
  1. +32
    -25
      pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java

+ 32
- 25
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<String> 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));
}
}

}

正在加载...
取消
保存