Commit 1025c13c authored by chenzhao's avatar chenzhao

ziliaoxiazai youhua

parent bae691d3
......@@ -64,6 +64,8 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
......@@ -875,15 +877,13 @@ public class CommonServiceImpl {
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", 100).build());
// response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFilename);
cleanup(ziLiaoDir);
}
private void fillSheet(Sheet sheet, Object data) {
if (Objects.isNull(null)){
if (Objects.isNull(data)){
return;
}
int startRow = 1;
......@@ -1454,25 +1454,25 @@ public class CommonServiceImpl {
// });
}
@Async
void cleanup(Path tempDir) {
try {
Files.walk(tempDir).sorted(Comparator.reverseOrder()).forEach(path -> {
try {
Files.delete(path);
} catch (IOException e) {
e.printStackTrace();
}
});
} catch (IOException e) {
e.printStackTrace();
}
}
private static String extractFileNameFromUrl(String url) {
String fileName = url.substring(url.lastIndexOf('/') + 1);
return fileName;
}
//@Async
//void cleanup(Path tempDir) {
// try {
// Files.walk(tempDir).sorted(Comparator.reverseOrder()).forEach(path -> {
// try {
// Files.delete(path);
// } catch (IOException e) {
// e.printStackTrace();
// }
// });
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// private static String extractFileNameFromUrl(String url) {
// String fileName = url.substring(url.lastIndexOf('/') + 1);
// return fileName;
// }
......@@ -1706,7 +1706,28 @@ void cleanup(Path tempDir) {
// }
}
@Async
public void cleanup(Path tempDir) {
try (Stream<Path> paths = Files.walk(tempDir)) {
List<Path> filesToDelete = paths.sorted(Comparator.reverseOrder())
.collect(Collectors.toList());
// 分批删除文件
int batchSize = 100; // 根据实际情况调整批次大小
for (int i = 0; i < filesToDelete.size(); i += batchSize) {
List<Path> batch = filesToDelete.subList(i, Math.min(i + batchSize, filesToDelete.size()));
batch.forEach(file -> {
try {
Files.delete(file);
} catch (IOException e) {
e.printStackTrace();
}
});
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static List<Map<String, Object>> convertList(List<Object> objectList) {
List<Map<String, Object>> result = new ArrayList<>();
......@@ -1760,11 +1781,14 @@ void cleanup(Path tempDir) {
List<Map<String, String>> items = (List<Map<String, String>>) stringStringMap.get("items");
List<String> values = new ArrayList<>();
int startNum = 1;
if (CollectionUtil.isNotEmpty(items)){
for (Map<String, String> item : items) {
values.add(startNum++ +"."+item.get("value")+"。") ;
}
urls.add(stringStringMap.get("type")+":"+ String.join("",values));
}
}
map.put("rectificationIdeas",String.join(",",urls));
}
maps.add(map);
......@@ -1828,7 +1852,7 @@ void cleanup(Path tempDir) {
List<ConstructionGirdRecords> getConstructionRecordsBasic (String peasantHouseholdId) {
// 施工自审操作记录
LambdaQueryWrapper<ConstructionGirdRecords> up5 = new LambdaQueryWrapper<ConstructionGirdRecords>();
up5.eq(ConstructionGirdRecords::getWorkOrderPowerStationId, peasantHouseholdId);
up5.eq(ConstructionGirdRecords::getPeasantHouseholdId, peasantHouseholdId);
up5.orderByAsc(ConstructionGirdRecords::getRecDate);
return constructionGirdRecordsMapper.selectList(up5);
}
......
......@@ -76,8 +76,6 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
@Autowired
private PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Autowired
private CommonServiceImpl commonService;
@Autowired
private AcceptanceCheckServiceImpl acceptanceCheckService;
@Autowired
private AcceptanceCheckAuditingServiceImpl acceptanceCheckAuditingService;
......
......@@ -40,6 +40,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
......@@ -141,6 +142,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
@Autowired
WorkFlowService workFlowService;
@Autowired
@Lazy
CommonServiceImpl commonService;
@Autowired
AmosRequestContext amosRequestContext;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment