Commit f1fc17fb authored by chenzhao's avatar chenzhao

ziliaoxiazai bug

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