Add file size update after upload
This commit is contained in:
@@ -656,6 +656,9 @@ public class CcdiFileUploadServiceImpl implements ICcdiFileUploadService {
|
||||
if (StringUtils.hasText(fileName)) {
|
||||
record.setFileName(fileName);
|
||||
}
|
||||
if (logItem.getFileSize() != null) {
|
||||
record.setFileSize(logItem.getFileSize());
|
||||
}
|
||||
|
||||
log.info("【文件上传】文件状态: status={}, uploadStatusDesc={}", status, uploadStatusDesc);
|
||||
boolean parseSuccess = status != null && status == -5
|
||||
|
||||
@@ -223,31 +223,37 @@ class CcdiFileUploadServiceImplTest {
|
||||
verify(bankStatementMapper).deleteByProjectIdAndBatchId(PROJECT_ID, LOG_ID);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// void processPullBankInfoAsync_shouldUpdateFileNameFromStatusResponse() {
|
||||
// when(lsfxClient.fetchInnerFlow(any())).thenReturn(buildFetchInnerFlowResponse(LOG_ID));
|
||||
// when(lsfxClient.checkParseStatus(LSFX_PROJECT_ID, String.valueOf(LOG_ID)))
|
||||
// .thenReturn(buildCheckParseStatusResponse(false));
|
||||
// when(lsfxClient.getFileUploadStatus(any())).thenReturn(buildParsedSuccessStatusResponse("XX身份证.xlsx"));
|
||||
// when(lsfxClient.getBankStatement(any(GetBankStatementRequest.class)))
|
||||
// .thenReturn(buildEmptyBankStatementResponse());
|
||||
//
|
||||
// CcdiFileUploadRecord record = buildRecord();
|
||||
// service.processPullBankInfoAsync(
|
||||
// PROJECT_ID,
|
||||
// LSFX_PROJECT_ID,
|
||||
// record,
|
||||
// "110101199001018888",
|
||||
// "2026-03-01",
|
||||
// "2026-03-10",
|
||||
// 9527L
|
||||
// );
|
||||
//
|
||||
// verify(recordMapper, org.mockito.Mockito.atLeastOnce()).updateById(org.mockito.ArgumentMatchers.<CcdiFileUploadRecord>argThat(item ->
|
||||
// "XX身份证.xlsx".equals(item.getFileName())));
|
||||
// verify(recordMapper, org.mockito.Mockito.atLeastOnce()).updateById(org.mockito.ArgumentMatchers.<CcdiFileUploadRecord>argThat(item ->
|
||||
// "parsed_success".equals(item.getFileStatus())));
|
||||
// }
|
||||
@Test
|
||||
void processPullBankInfoAsync_shouldUpdateFileSizeFromStatusResponse() {
|
||||
GetFileUploadStatusResponse statusResponse = buildParsedSuccessStatusResponse("XX身份证.xlsx");
|
||||
statusResponse.getData().getLogs().get(0).setFileSize(2048L);
|
||||
|
||||
when(lsfxClient.fetchInnerFlow(any())).thenReturn(buildFetchInnerFlowResponse(LOG_ID));
|
||||
when(lsfxClient.checkParseStatus(LSFX_PROJECT_ID, String.valueOf(LOG_ID)))
|
||||
.thenReturn(buildCheckParseStatusResponse(false));
|
||||
when(lsfxClient.getFileUploadStatus(any())).thenReturn(statusResponse);
|
||||
when(lsfxClient.getBankStatement(any(GetBankStatementRequest.class)))
|
||||
.thenReturn(buildEmptyBankStatementResponse());
|
||||
|
||||
CcdiFileUploadRecord record = buildRecord();
|
||||
record.setFileSize(0L);
|
||||
|
||||
service.processPullBankInfoAsync(
|
||||
PROJECT_ID,
|
||||
LSFX_PROJECT_ID,
|
||||
record,
|
||||
"110101199001018888",
|
||||
"2026-03-01",
|
||||
"2026-03-10"
|
||||
);
|
||||
|
||||
verify(recordMapper, org.mockito.Mockito.atLeastOnce()).updateById(
|
||||
org.mockito.ArgumentMatchers.<CcdiFileUploadRecord>argThat(item ->
|
||||
Long.valueOf(2048L).equals(item.getFileSize())
|
||||
&& "XX身份证.xlsx".equals(item.getFileName())
|
||||
&& "parsed_success".equals(item.getFileStatus()))
|
||||
);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// void processPullBankInfoAsync_shouldMarkParsedFailedWhenFetchInnerFlowThrows() {
|
||||
|
||||
Reference in New Issue
Block a user