Commit 1025c13c authored by chenzhao's avatar chenzhao

ziliaoxiazai youhua

parent bae691d3
...@@ -64,6 +64,8 @@ import java.util.concurrent.ExecutionException; ...@@ -64,6 +64,8 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -875,15 +877,13 @@ public class CommonServiceImpl { ...@@ -875,15 +877,13 @@ public class CommonServiceImpl {
redisUtils.set(redisKey, MapBuilder.<String, Object>create() redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", 100).build()); .put("value", 100).build());
// response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFilename);
cleanup(ziLiaoDir); cleanup(ziLiaoDir);
} }
private void fillSheet(Sheet sheet, Object data) { private void fillSheet(Sheet sheet, Object data) {
if (Objects.isNull(null)){ if (Objects.isNull(data)){
return; return;
} }
int startRow = 1; int startRow = 1;
...@@ -1454,25 +1454,25 @@ public class CommonServiceImpl { ...@@ -1454,25 +1454,25 @@ public class CommonServiceImpl {
// }); // });
} }
@Async //@Async
void cleanup(Path tempDir) { //void cleanup(Path tempDir) {
try { // try {
Files.walk(tempDir).sorted(Comparator.reverseOrder()).forEach(path -> { // Files.walk(tempDir).sorted(Comparator.reverseOrder()).forEach(path -> {
try { // try {
Files.delete(path); // Files.delete(path);
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
}); // });
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
//
private static String extractFileNameFromUrl(String url) { // private static String extractFileNameFromUrl(String url) {
String fileName = url.substring(url.lastIndexOf('/') + 1); // String fileName = url.substring(url.lastIndexOf('/') + 1);
return fileName; // return fileName;
} // }
...@@ -1706,7 +1706,28 @@ void cleanup(Path tempDir) { ...@@ -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) { public static List<Map<String, Object>> convertList(List<Object> objectList) {
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
...@@ -1760,10 +1781,13 @@ void cleanup(Path tempDir) { ...@@ -1760,10 +1781,13 @@ void cleanup(Path tempDir) {
List<Map<String, String>> items = (List<Map<String, String>>) stringStringMap.get("items"); List<Map<String, String>> items = (List<Map<String, String>>) stringStringMap.get("items");
List<String> values = new ArrayList<>(); List<String> values = new ArrayList<>();
int startNum = 1; int startNum = 1;
for (Map<String, String> item : items) { if (CollectionUtil.isNotEmpty(items)){
values.add(startNum++ +"."+item.get("value")+"。") ; for (Map<String, String> item : items) {
values.add(startNum++ +"."+item.get("value")+"。") ;
}
urls.add(stringStringMap.get("type")+":"+ String.join("",values));
} }
urls.add(stringStringMap.get("type")+":"+ String.join("",values));
} }
map.put("rectificationIdeas",String.join(",",urls)); map.put("rectificationIdeas",String.join(",",urls));
} }
...@@ -1828,7 +1852,7 @@ void cleanup(Path tempDir) { ...@@ -1828,7 +1852,7 @@ void cleanup(Path tempDir) {
List<ConstructionGirdRecords> getConstructionRecordsBasic (String peasantHouseholdId) { List<ConstructionGirdRecords> getConstructionRecordsBasic (String peasantHouseholdId) {
// 施工自审操作记录 // 施工自审操作记录
LambdaQueryWrapper<ConstructionGirdRecords> up5 = new LambdaQueryWrapper<ConstructionGirdRecords>(); LambdaQueryWrapper<ConstructionGirdRecords> up5 = new LambdaQueryWrapper<ConstructionGirdRecords>();
up5.eq(ConstructionGirdRecords::getWorkOrderPowerStationId, peasantHouseholdId); up5.eq(ConstructionGirdRecords::getPeasantHouseholdId, peasantHouseholdId);
up5.orderByAsc(ConstructionGirdRecords::getRecDate); up5.orderByAsc(ConstructionGirdRecords::getRecDate);
return constructionGirdRecordsMapper.selectList(up5); return constructionGirdRecordsMapper.selectList(up5);
} }
......
...@@ -76,8 +76,6 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina ...@@ -76,8 +76,6 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
@Autowired @Autowired
private PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper; private PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Autowired @Autowired
private CommonServiceImpl commonService;
@Autowired
private AcceptanceCheckServiceImpl acceptanceCheckService; private AcceptanceCheckServiceImpl acceptanceCheckService;
@Autowired @Autowired
private AcceptanceCheckAuditingServiceImpl acceptanceCheckAuditingService; private AcceptanceCheckAuditingServiceImpl acceptanceCheckAuditingService;
......
...@@ -40,6 +40,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -40,6 +40,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -141,6 +142,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -141,6 +142,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
@Autowired @Autowired
WorkFlowService workFlowService; WorkFlowService workFlowService;
@Autowired @Autowired
@Lazy
CommonServiceImpl commonService; CommonServiceImpl commonService;
@Autowired @Autowired
AmosRequestContext amosRequestContext; 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