提交资产导入拆分当前进展
This commit is contained in:
@@ -109,11 +109,11 @@ class CcdiAssetInfoControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void importTemplate_shouldUseRelativeAssetTemplateName() {
|
||||
void importTemplate_shouldUseGenericAssetTemplateName() {
|
||||
try (MockedStatic<EasyExcelUtil> mocked = mockStatic(EasyExcelUtil.class)) {
|
||||
controller.importTemplate(null);
|
||||
|
||||
mocked.verify(() -> EasyExcelUtil.importTemplateWithDictDropdown(null, CcdiAssetInfoExcel.class, "亲属资产信息"));
|
||||
mocked.verify(() -> EasyExcelUtil.importTemplateWithDictDropdown(null, CcdiAssetInfoExcel.class, "资产信息"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,22 @@ class CcdiAssetInfoImportServiceImplTest {
|
||||
assertEquals("320101199001010011", captor.getValue().get(0).getPersonId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void importAssetInfoAsync_shouldResolveFamilyIdFromEmployeeIdCardBeforeFamilyRelation() {
|
||||
CcdiAssetInfoExcel excel = buildExcel("320101199001010011", "房产");
|
||||
when(redisTemplate.opsForHash()).thenReturn(hashOperations);
|
||||
when(assetInfoMapper.selectOwnerCandidatesByPersonIds(List.of("320101199001010011")))
|
||||
.thenReturn(List.of(owner("320101199001010011", "320101199001010011")));
|
||||
|
||||
service.importAssetInfoAsync(List.of(excel), "task-self", "tester");
|
||||
|
||||
ArgumentCaptor<List<CcdiAssetInfo>> captor = ArgumentCaptor.forClass(List.class);
|
||||
verify(assetInfoMapper).insertBatch(captor.capture());
|
||||
assertEquals("320101199001010011", captor.getValue().get(0).getFamilyId());
|
||||
assertEquals("320101199001010011", captor.getValue().get(0).getPersonId());
|
||||
verify(assetInfoMapper, never()).selectOwnerCandidatesByRelationCertNos(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void importAssetInfoAsync_shouldResolveFamilyIdFromFamilyRelationIdCard() {
|
||||
CcdiAssetInfoExcel excel = buildExcel("320101199201010022", "车辆");
|
||||
@@ -134,7 +150,7 @@ class CcdiAssetInfoImportServiceImplTest {
|
||||
assertEquals(1, failures.size());
|
||||
AssetImportFailureVO failure = (AssetImportFailureVO) failures.get(0);
|
||||
assertEquals("320101199001010099", failure.getPersonId());
|
||||
assertTrue(failure.getErrorMessage().contains("未找到亲属资产归属员工"));
|
||||
assertTrue(failure.getErrorMessage().contains("未找到资产归属员工"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -154,7 +170,7 @@ class CcdiAssetInfoImportServiceImplTest {
|
||||
ArgumentCaptor<Object> failureCaptor = ArgumentCaptor.forClass(Object.class);
|
||||
verify(valueOperations).set(eq("import:assetInfo:task-4:failures"), failureCaptor.capture(), eq(7L), eq(TimeUnit.DAYS));
|
||||
AssetImportFailureVO failure = (AssetImportFailureVO) ((List<?>) failureCaptor.getValue()).get(0);
|
||||
assertTrue(failure.getErrorMessage().contains("亲属资产归属员工不唯一"));
|
||||
assertTrue(failure.getErrorMessage().contains("资产归属员工不唯一"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -175,7 +191,7 @@ class CcdiAssetInfoImportServiceImplTest {
|
||||
));
|
||||
AssetImportFailureVO failureVO = new AssetImportFailureVO();
|
||||
failureVO.setPersonId("320101199001010099");
|
||||
failureVO.setErrorMessage("未找到亲属资产归属员工");
|
||||
failureVO.setErrorMessage("未找到资产归属员工");
|
||||
when(valueOperations.get("import:assetInfo:task-5:failures")).thenReturn(List.of(failureVO));
|
||||
|
||||
ImportStatusVO statusVO = service.getImportStatus("task-5");
|
||||
|
||||
Reference in New Issue
Block a user