Commit f1fc17fb authored by chenzhao's avatar chenzhao

ziliaoxiazai bug

parent 36a79748
......@@ -109,7 +109,7 @@ public class CommonServiceImpl {
private static final String TEMPLATE_FILE_PATH = "templates/informationTemp.xlsx"; // 模版文件路径
private ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
private ExecutorService executorService = Executors.newFixedThreadPool(30); // 创建固定大小的线程池
private ExecutorService executorService = Executors.newFixedThreadPool(50); // 创建固定大小的线程池
public String getRouthPath(String type,Object model) {
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
String routhPath="";
......@@ -508,6 +508,8 @@ public class CommonServiceImpl {
String redisKey = "";
if (peasantHouseholdIds.size()>1){
redisKey = String.join(",", peasantHouseholdIds);
}else {
redisKey = peasantHouseholdIds.get(0);
}
int baifenbi = 100 / peasantHouseholdIds.size();
int currentBili = 0;
......@@ -519,7 +521,7 @@ public class CommonServiceImpl {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId, peasantHouseholdId, processInstanceId, null);
fileName = returnDto.getSurveyInformation().getOwnersName();
int current = 0;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", current).build());
String powerStationInstanceId = powerStationMapper.getInstanceIdByhouseId(peasantHouseholdId);
String basicGridInstanceId = basicGridAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
......@@ -617,7 +619,7 @@ public class CommonServiceImpl {
e.printStackTrace();
}
current = current + 15 ;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", current).build());
List<HygfRectificationOrder> areaOrdersCon = Optional.ofNullable(returnDto.getPowerStationConstructionData().getAreaOrders())
.orElse(new ArrayList<>());
......@@ -637,12 +639,13 @@ public class CommonServiceImpl {
addNonNullList(areaOrders, returnDto.getAcceptanceCheck().getPropertyOrders());
List<Future<?>> futures = new ArrayList<>();
futures.add(executorService.submit(() -> {
String finalRedisKey = redisKey;
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getSurveyInformation(),"基本信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -651,9 +654,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getSurveyDetails(),"勘察信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -662,9 +665,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getDesignInformation(),"设计信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -673,9 +676,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getCommercial(),"商务信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -684,9 +687,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getInformation(),"资料归档附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -695,9 +698,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getPowerStationConstructionData(),"施工信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -706,9 +709,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrdersCon,"施工信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -717,9 +720,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getHygfOnGrid(),"并网信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -728,9 +731,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrders,"并网信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -739,9 +742,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getWorkOrder(),"派工单信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -750,9 +753,9 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrdersAcc,"验收信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
......@@ -774,15 +777,13 @@ public class CommonServiceImpl {
return;
}
}
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", 100).build());
// response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename="+returnDto.getSurveyInformation().getOwnersName()+".zip");
currentBili = currentBili + baifenbi;
redisUtils.set(redisKey,MapBuilder.<String, Object>create()
.put("value", currentBili).build());
}
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", 100).build());
String encodedFilename = "";
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
......@@ -796,6 +797,8 @@ public class CommonServiceImpl {
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName+".zip", "UTF-8"));
createZipFile(ziLiaoDir, "批量资料/"+fileName,response);
}
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", 100).build());
// response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFilename);
......@@ -1178,7 +1181,7 @@ public class CommonServiceImpl {
startRowNum= dataStartRow +1;
// 假设表头内容如下:
String headerOne = "施工完工操作记录";
String headerOne = "操作记录";
String[] headersNames = {"操作人","操作内容","操作时间", "备注",};
String[] headers = {"operator", "operationContent", "operationTime", "notes"};
List<Map<String, Object>> maps = convertListToMap((List<?>) data);
......@@ -1391,16 +1394,18 @@ public class CommonServiceImpl {
try {
@SuppressWarnings("unchecked")
List<Object> urlList = (List<Object>) FieldUtils.readField(field, obj, true);
// 从List<Object>中提取url值
for (Object item : urlList) {
if (item instanceof Map) {
Map<String, Object> map = (Map<String, Object>) item;
if (map.containsKey("url") && map.get("url") instanceof String) {
urls.add(urlPath+(String) map.get("url"));
if (CollectionUtil.isNotEmpty(urlList)){
// 从List<Object>中提取url值
for (Object item : urlList) {
if (item instanceof Map) {
Map<String, Object> map = (Map<String, Object>) item;
if (map.containsKey("url") && map.get("url") instanceof String) {
urls.add(urlPath+(String) map.get("url"));
}
}
}
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
......
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