|
|
@@ -0,0 +1,75 @@ |
|
|
|
package com.ningdatech.pmapi.projectCollection; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.ningdatech.pmapi.AppTests; |
|
|
|
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; |
|
|
|
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; |
|
|
|
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; |
|
|
|
import com.ningdatech.pmapi.gov.model.entity.*; |
|
|
|
import com.ningdatech.pmapi.gov.service.*; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; |
|
|
|
import org.junit.Test; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Classname ProjectCollectionTest |
|
|
|
* @Description |
|
|
|
* @Date 2023/9/7 15:08 |
|
|
|
* @Author PoffyZhang |
|
|
|
*/ |
|
|
|
public class ProjectCollectionTest extends AppTests { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IGovBizProjectBaseinfoService baseinfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IGovBizProjectApplyService applyService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IGovBizProjectApproveService approveService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IGovBizProjectCimplementService cimplementService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IGovBizProjectMimplementService mimplementService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IGovBizProjectProcureService procureService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GenerateProjectCodeUtil generateProjectCodeUtil; |
|
|
|
|
|
|
|
@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)); |
|
|
|
|
|
|
|
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)); |
|
|
|
} |
|
|
|
|
|
|
|
} |