SUPPORT-9570: очистка таблички обжалований
This commit is contained in:
parent
c87563b28a
commit
c50ae185f5
2 changed files with 9 additions and 4 deletions
|
|
@ -26,7 +26,10 @@ public class AppealsDao {
|
|||
this.dslContext = dslContext;
|
||||
}
|
||||
|
||||
public void save(List<Map<String, String>> records) {
|
||||
public void replaceAll(List<Map<String, String>> records) {
|
||||
dslContext.truncate(APPEALS_LIST)
|
||||
.execute();
|
||||
|
||||
LocalDateTime uploadDate = LocalDateTime.now();
|
||||
List<AppealsListRecord> appealRecords = new ArrayList<>();
|
||||
|
||||
|
|
@ -38,8 +41,8 @@ public class AppealsDao {
|
|||
appealRecords.add(appealRecord);
|
||||
}
|
||||
}
|
||||
dslContext.batchMerge(appealRecords)
|
||||
.execute();
|
||||
dslContext.batchInsert(appealRecords)
|
||||
.execute();
|
||||
}
|
||||
|
||||
private Map<String, Object> createFieldsMap(Map<String, String> valueMap, LocalDateTime uploadDate) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import java.util.*;
|
|||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ru.micord.ervu_dashboard.dao.AppealsDao;
|
||||
import ru.micord.ervu_dashboard.exception.FileUploadException;
|
||||
|
|
@ -28,9 +29,10 @@ public class AppealsFileUploadService {
|
|||
this.requiredHeaders = getRequiredHeaders(rawHeaders);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void save(MultipartFile file) {
|
||||
List<Map<String, String>> maps = parseFile(file);
|
||||
appealsDao.save(maps);
|
||||
appealsDao.replaceAll(maps);
|
||||
}
|
||||
|
||||
private List<Map<String, String>> parseFile(MultipartFile file) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue