Commit 0f7dc1d0 authored by chenzhao's avatar chenzhao

ziliaoxiazai

parent 5d5996fb
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.google.common.net.HttpHeaders;
import com.yeejoin.amos.boot.module.hygf.api.dto.CommerceInfoDto;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.FinancingInfoServiceImpl;
import io.swagger.annotations.Api;
......@@ -45,18 +46,18 @@ public class CommonController {
@GetMapping(value = "/downInformation")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "资料下载", notes = "资料下载")
public void downList(HttpServletResponse response, @RequestParam(required = false) String surveyInformationId,
@RequestParam(required = false)String peasantHouseholdId,
public ResponseModel downList(HttpServletResponse response, @RequestParam(required = false) String surveyInformationId,
@RequestParam(required = false)List<String> peasantHouseholdIds,
@RequestParam(required = false)String processInstanceId) throws IOException {
// 设置响应头
response.setContentType("application/zip");
commonService.downZiliao(surveyInformationId,peasantHouseholdId,processInstanceId,response);
commonService.downZiliao(surveyInformationId,peasantHouseholdIds,processInstanceId,response);
return CommonResponseNewUtil.success();
}
/**
* 设备信息下载
*
......@@ -65,9 +66,9 @@ public class CommonController {
@GetMapping(value = "/getSchedule")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "资料下载进度获取", notes = "资料下载进度获取")
public Object getSchedule(String peasantHouseholdId) {
public ResponseModel<Object> getSchedule(String peasantHouseholdId) {
return commonService.getSchedule(peasantHouseholdId);
return ResponseHelper.buildResponse(commonService.getSchedule(peasantHouseholdId));
}
......
......@@ -499,275 +499,297 @@ public class CommonServiceImpl {
return jsonArray;
}
public void downZiliao(String surveyInformationId, String peasantHouseholdId, String processInstanceId, HttpServletResponse response) throws IOException {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId, peasantHouseholdId, processInstanceId, null);
int current = 0;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", current).build());
String powerStationInstanceId = powerStationMapper.getInstanceIdByhouseId(peasantHouseholdId);
String workOrderStationInstanceId = workOrderStationAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
String basicGridInstanceId = basicGridAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
String financingInstanceId = financingAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
List<LinkedHashMap> powerStationWorkLog = new ArrayList<>();
List<ConstructionRecords> workOrderStationWorkLog = new ArrayList<>();
List<LinkedHashMap> basicGridWorkLog = new ArrayList<>();
List<LinkedHashMap> financingWorkLog = new ArrayList<>();
List<LinkedHashMap> accptWorkLog = new ArrayList<>();
workOrderStationWorkLog = this.getConstructionRecords(peasantHouseholdId);
try {
powerStationWorkLog = this.getWorkLog(powerStationInstanceId);
basicGridWorkLog = this.getWorkLog(basicGridInstanceId);
financingWorkLog = this.getWorkLog(financingInstanceId);
accptWorkLog = this.getWorkLog(returnDto.getAcceptanceCheck().getInstanceId());
}catch (Exception e){
e.printStackTrace();
public void downZiliao(String surveyInformationId, List<String> peasantHouseholdIds, String processInstanceId, HttpServletResponse response) throws IOException {
String fileName = "";
String redisKey = "";
if (peasantHouseholdIds.size()>1){
redisKey = String.join(",", peasantHouseholdIds);
}
Path templateDir = Paths.get(TEMPLATE_FILE_PATH).getParent();
System.out.println("模版文件所在目录是: " + templateDir);
int baifenbi = 100 / peasantHouseholdIds.size();
int currentBili = 0;
Path currentWorkingDir = Paths.get("");
// 获取当前工作目录
Path rootDir = currentWorkingDir;
Path tempDir =rootDir.resolve(returnDto.getSurveyInformation().getOwnersName());
try {
Files.createDirectories(tempDir); // 创建临时目录
System.out.println("Temporary directory created at: " + tempDir);
} catch (IOException e) {
e.printStackTrace();
return;
}
String templatePath = "templates/informationTemp.xlsx";
//String templatePath = "F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\informationTemp.xlsx";
// String outputPath = "F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\temp\\"+returnDto.getSurveyInformation().getOwnersName()+".xlsx";
String outputPath = returnDto.getSurveyInformation().getOwnersName()+"/"+returnDto.getSurveyInformation().getOwnersName()+".xlsx";
Path ziLiaoDir =rootDir.resolve("批量资料");
for (String peasantHouseholdId : peasantHouseholdIds) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId, peasantHouseholdId, processInstanceId, null);
fileName = returnDto.getSurveyInformation().getOwnersName();
int current = 0;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", current).build());
String powerStationInstanceId = powerStationMapper.getInstanceIdByhouseId(peasantHouseholdId);
String workOrderStationInstanceId = workOrderStationAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
String basicGridInstanceId = basicGridAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
String financingInstanceId = financingAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
List<LinkedHashMap> powerStationWorkLog = new ArrayList<>();
List<ConstructionRecords> workOrderStationWorkLog = new ArrayList<>();
List<LinkedHashMap> basicGridWorkLog = new ArrayList<>();
List<LinkedHashMap> financingWorkLog = new ArrayList<>();
List<LinkedHashMap> accptWorkLog = new ArrayList<>();
workOrderStationWorkLog = this.getConstructionRecords(peasantHouseholdId);
Workbook workbook = null;
try ( InputStream fis = new ClassPathResource(templatePath).getInputStream()){
workbook = new XSSFWorkbook(fis);
try {
powerStationWorkLog = this.getWorkLog(powerStationInstanceId);
basicGridWorkLog = this.getWorkLog(basicGridInstanceId);
financingWorkLog = this.getWorkLog(financingInstanceId);
accptWorkLog = this.getWorkLog(returnDto.getAcceptanceCheck().getInstanceId());
Sheet firstSheet = workbook.getSheetAt(0);
fillSheet(firstSheet, returnDto.getSurveyInformation());
}catch (Exception e){
e.printStackTrace();
}
Sheet secondSheet = workbook.getSheetAt(1);
fillSheet(secondSheet, returnDto.getSurveyDetails());
Sheet secondSheet2 = workbook.getSheetAt(2);
fillSheet(secondSheet2, returnDto.getDesignInformation());
Path templateDir = Paths.get(TEMPLATE_FILE_PATH).getParent();
System.out.println("模版文件所在目录是: " + templateDir);
Sheet secondSheet3 = workbook.getSheetAt(3);
fillSheet(secondSheet3, returnDto.getCommercial());
Path tempDir =ziLiaoDir.resolve(returnDto.getSurveyInformation().getOwnersName());
try {
Files.createDirectories(tempDir); // 创建临时目录
System.out.println("Temporary directory created at: " + tempDir);
} catch (IOException e) {
e.printStackTrace();
return;
}
String templatePath = "templates/informationTemp.xlsx";
//String templatePath = "F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\informationTemp.xlsx";
// String outputPath = "F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\temp\\"+returnDto.getSurveyInformation().getOwnersName()+".xlsx";
String outputPath ="批量资料/"+ returnDto.getSurveyInformation().getOwnersName()+"/"+returnDto.getSurveyInformation().getOwnersName()+".xlsx";
Sheet secondSheet4 = workbook.getSheetAt(4);
fillSheet(secondSheet4, returnDto.getExtendedInformation());
Workbook workbook = null;
try ( InputStream fis = new ClassPathResource(templatePath).getInputStream()){
workbook = new XSSFWorkbook(fis);
Sheet secondSheet5 = workbook.getSheetAt(5);
fillSheet(secondSheet5, returnDto.getInformation());
Sheet firstSheet = workbook.getSheetAt(0);
fillSheet(firstSheet, returnDto.getSurveyInformation());
Sheet secondSheet6 = workbook.getSheetAt(6);
fillSheet(secondSheet6, returnDto.getPowerStationEngineeringInfo());
Sheet secondSheet = workbook.getSheetAt(1);
fillSheet(secondSheet, returnDto.getSurveyDetails());
Sheet secondSheet10 = workbook.getSheetAt(7);
fillSheet(secondSheet10, returnDto.getPowerStationConstructionData());
Sheet secondSheet2 = workbook.getSheetAt(2);
fillSheet(secondSheet2, returnDto.getDesignInformation());
Sheet secondSheet7 = workbook.getSheetAt(8);
fillSheet(secondSheet7, returnDto.getHygfOnGrid());
Sheet secondSheet3 = workbook.getSheetAt(3);
fillSheet(secondSheet3, returnDto.getCommercial());
Sheet secondSheet8 = workbook.getSheetAt(9);
fillSheet(secondSheet8, returnDto.getWorkOrder());
Sheet secondSheet4 = workbook.getSheetAt(4);
fillSheet(secondSheet4, returnDto.getExtendedInformation());
Sheet secondSheet9 = workbook.getSheetAt(10);
fillSheet(secondSheet9, returnDto.getAcceptanceCheck());
Sheet secondSheet5 = workbook.getSheetAt(5);
fillSheet(secondSheet5, returnDto.getInformation());
Sheet secondSheet11 = workbook.getSheetAt(11);
fillSheet(secondSheet11, powerStationWorkLog);
Sheet secondSheet6 = workbook.getSheetAt(6);
fillSheet(secondSheet6, returnDto.getPowerStationEngineeringInfo());
Sheet secondSheet12 = workbook.getSheetAt(12);
fillSheet(secondSheet12, workOrderStationWorkLog);
Sheet secondSheet10 = workbook.getSheetAt(7);
fillSheet(secondSheet10, returnDto.getPowerStationConstructionData());
Sheet secondSheet13 = workbook.getSheetAt(13);
fillSheet(secondSheet13, basicGridWorkLog);
Sheet secondSheet7 = workbook.getSheetAt(8);
fillSheet(secondSheet7, returnDto.getHygfOnGrid());
Sheet secondSheet14 = workbook.getSheetAt(14);
fillSheet(secondSheet14, accptWorkLog);
Sheet secondSheet8 = workbook.getSheetAt(9);
fillSheet(secondSheet8, returnDto.getWorkOrder());
Sheet secondSheet15 = workbook.getSheetAt(15);
fillSheet(secondSheet15, financingWorkLog);
// 写入到新的Excel文件中
try (FileOutputStream fos = new FileOutputStream(outputPath)) {
workbook.write(fos);
}
} catch (IOException e) {
e.printStackTrace();
}
current = current + 15 ;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", current).build());
List<HygfRectificationOrder> areaOrdersCon = Optional.ofNullable(returnDto.getPowerStationConstructionData().getAreaOrders())
.orElse(new ArrayList<>());
addNonNullList(areaOrdersCon, returnDto.getPowerStationConstructionData().getDesignOrders());
addNonNullList(areaOrdersCon, returnDto.getPowerStationConstructionData().getEngineeringOrders());
// 主方法或代码块
List<HygfRectificationOrder> areaOrders = Optional.ofNullable(returnDto.getHygfOnGrid().getAreaOrders())
.orElse(new ArrayList<>());
addNonNullList(areaOrders, returnDto.getHygfOnGrid().getDesignOrders());
addNonNullList(areaOrders, returnDto.getHygfOnGrid().getEngineeringOrders());
List<HygfRectificationOrder> areaOrdersAcc = Optional.ofNullable(returnDto.getAcceptanceCheck().getAreaOrders())
.orElse(new ArrayList<>());
addNonNullList(areaOrders, returnDto.getAcceptanceCheck().getLegalOrders());
addNonNullList(areaOrders, returnDto.getAcceptanceCheck().getFinanceOrders());
addNonNullList(areaOrders, returnDto.getAcceptanceCheck().getPropertyOrders());
List<Future<?>> futures = new ArrayList<>();
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getSurveyInformation(),"基本信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getSurveyDetails(),"勘察信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getDesignInformation(),"设计信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getCommercial(),"商务信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getInformation(),"资料归档附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getPowerStationConstructionData(),"施工信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrdersCon,"施工信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getHygfOnGrid(),"并网信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrders,"并网信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getWorkOrder(),"派工单信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrdersAcc,"验收信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
Sheet secondSheet9 = workbook.getSheetAt(10);
fillSheet(secondSheet9, returnDto.getAcceptanceCheck());
Sheet secondSheet11 = workbook.getSheetAt(11);
fillSheet(secondSheet11, powerStationWorkLog);
Sheet secondSheet12 = workbook.getSheetAt(12);
fillSheet(secondSheet12, workOrderStationWorkLog);
Sheet secondSheet13 = workbook.getSheetAt(13);
fillSheet(secondSheet13, basicGridWorkLog);
Sheet secondSheet14 = workbook.getSheetAt(14);
fillSheet(secondSheet14, accptWorkLog);
Sheet secondSheet15 = workbook.getSheetAt(15);
fillSheet(secondSheet15, financingWorkLog);
// 写入到新的Excel文件中
try (FileOutputStream fos = new FileOutputStream(outputPath)) {
workbook.write(fos);
}
} catch (IOException e) {
e.printStackTrace();
}
}));
// 等待所有任务完成
for (Future<?> future : futures) {
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof IOException) {
((IOException) cause).printStackTrace();
// 可以在这里记录日志或者采取其他补救措施
} else {
current = current + 15 ;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", current).build());
List<HygfRectificationOrder> areaOrdersCon = Optional.ofNullable(returnDto.getPowerStationConstructionData().getAreaOrders())
.orElse(new ArrayList<>());
addNonNullList(areaOrdersCon, returnDto.getPowerStationConstructionData().getDesignOrders());
addNonNullList(areaOrdersCon, returnDto.getPowerStationConstructionData().getEngineeringOrders());
// 主方法或代码块
List<HygfRectificationOrder> areaOrders = Optional.ofNullable(returnDto.getHygfOnGrid().getAreaOrders())
.orElse(new ArrayList<>());
addNonNullList(areaOrders, returnDto.getHygfOnGrid().getDesignOrders());
addNonNullList(areaOrders, returnDto.getHygfOnGrid().getEngineeringOrders());
List<HygfRectificationOrder> areaOrdersAcc = Optional.ofNullable(returnDto.getAcceptanceCheck().getAreaOrders())
.orElse(new ArrayList<>());
addNonNullList(areaOrders, returnDto.getAcceptanceCheck().getLegalOrders());
addNonNullList(areaOrders, returnDto.getAcceptanceCheck().getFinanceOrders());
addNonNullList(areaOrders, returnDto.getAcceptanceCheck().getPropertyOrders());
List<Future<?>> futures = new ArrayList<>();
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getSurveyInformation(),"基本信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
// 根据具体情况,可以在这里选择终止程序或进行其他处理
return;
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getSurveyDetails(),"勘察信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getDesignInformation(),"设计信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getCommercial(),"商务信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getInformation(),"资料归档附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getPowerStationConstructionData(),"施工信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrdersCon,"施工信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getHygfOnGrid(),"并网信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrders,"并网信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getWorkOrder(),"派工单信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrdersAcc,"验收信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(peasantHouseholdId);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(peasantHouseholdId, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
} catch (IOException e) {
e.printStackTrace();
}
}));
// 等待所有任务完成
for (Future<?> future : futures) {
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof IOException) {
((IOException) cause).printStackTrace();
// 可以在这里记录日志或者采取其他补救措施
} else {
e.printStackTrace();
}
// 根据具体情况,可以在这里选择终止程序或进行其他处理
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(peasantHouseholdId, MapBuilder.<String, Object>create()
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", 100).build());
// response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename="+returnDto.getSurveyInformation().getOwnersName()+".zip");
String encodedFilename = URLEncoder.encode(returnDto.getSurveyInformation().getOwnersName() + ".zip", StandardCharsets.UTF_8.name());
String encodedFilename = "";
if (peasantHouseholdIds.size() > 1){
fileName = "批量资料";
encodedFilename = URLEncoder.encode( "批量资料.zip", StandardCharsets.UTF_8.name());
}else {
encodedFilename = URLEncoder.encode( fileName+".zip", StandardCharsets.UTF_8.name());
}
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFilename);
createZipFile(tempDir, returnDto.getSurveyInformation().getOwnersName(),response);
cleanup(tempDir);
createZipFile(ziLiaoDir, "批量资料/"+fileName,response);
cleanup(ziLiaoDir);
}
......@@ -793,58 +815,58 @@ public class CommonServiceImpl {
DesignInformationDto designInformation= (DesignInformationDto)data;
int startRowNum = 5;
if (null != designInformation.getAssembly()){
List<Map<String, Object>> maps = convertList(designInformation.getAssembly());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2;
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "组件";
String[] headersNames = {"物联编码", "物料名称", "电池片规格", "功率", "类型", "边框", "总功率", "单/双面", "配置数量", "金额"};
String[] headers = {"wlbm", "wlmc", "dcpgg", "gl", "lx", "bk", "zgl", "dsm", "pzsl", "price"};
List<Map<String, Object>> maps = convertList(designInformation.getAssembly());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != designInformation.getInverter()){
List<Map<String, Object>> maps = convertList(designInformation.getInverter());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2;
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "逆变器";
String[] headersNames = {"物联编码", "物料名称", "功率", "系列", "相位", "配置数量", "金额"};
String[] headers = {"wlbm", "wlmc", "gl", "xl", "xw", "pzsl", "price"};
List<Map<String, Object>> maps = convertList(designInformation.getInverter());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != designInformation.getElectricityMeter()){
List<Map<String, Object>> maps = convertList(designInformation.getElectricityMeter());
int headerRow = startRowNum +1 ; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2;
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "并网箱";
String[] headersNames = {"物联编码", "物料名称","材质", "功率", "类型", "功能", "相位", "上网模式", "配置数量", "金额"};
String[] headers = {"wlbm", "wlmc","cz", "gl", "lx", "gn", "xw", "swms","pzsl", "price"};
List<Map<String, Object>> maps = convertList(designInformation.getElectricityMeter());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != designInformation.getCable()){
List<Map<String, Object>> maps = convertList(designInformation.getCable());
int headerRow = startRowNum +1 ; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2;
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "电缆";
String[] headersNames = {"物联编码", "物料名称", "型号", "规格", "配置数量"};
String[] headers = {"wlbm", "wlmc", "xh", "gg", "pzsl"};
List<Map<String, Object>> maps = convertList(designInformation.getCable());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
......@@ -856,58 +878,62 @@ public class CommonServiceImpl {
int startRowNum = 3;
if (null != powerStationEngineeringInfo.getConstructionComponentInfo()){
List<Map<String, Object>> maps = convertList(powerStationEngineeringInfo.getConstructionComponentInfo());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2;
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "组件序列号";
String[] headersNames = {"序列号","功率","物联编码", "物料名称", "电池片规格", "类型", "边框", "单/双面"};
String[] headers = {"xlh","gl","wlbm", "wlmc", "dcpgg", "lx", "bk", "dsm"};
List<Map<String, Object>> maps = convertList(powerStationEngineeringInfo.getConstructionComponentInfo());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != powerStationEngineeringInfo.getConstructionInverterInfo()){
List<Map<String, Object>> maps = convertList(powerStationEngineeringInfo.getConstructionInverterInfo());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2;
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "逆变器序列号";
String[] headersNames = {"序列号","验证码","功率","物联编码", "物料名称", "系列", "相位"};
String[] headers = {"xlh","yzm","gl", "wlbm", "wlmc", "xl", "xw"};
List<Map<String, Object>> maps = convertList(powerStationEngineeringInfo.getConstructionInverterInfo());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != powerStationEngineeringInfo.getConstructionGridBoxInfo()){
List<Map<String, Object>> maps = convertList(powerStationEngineeringInfo.getConstructionGridBoxInfo());
int headerRow = startRowNum +1 ; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2;
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "并网箱序列号";
String[] headersNames = {"序列号", "功率","物联编码", "物料名称","材质", "类型", "功能", "相位", "上网模式"};
String[] headers = {"xlh","gl","wlbm", "wlmc","cz","lx", "gn", "xw", "swms"};
List<Map<String, Object>> maps = convertList(powerStationEngineeringInfo.getConstructionGridBoxInfo());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != powerStationEngineeringInfo.getConstructionCollectorBoxInfo()){
List<Map<String, Object>> maps = convertList(powerStationEngineeringInfo.getConstructionCollectorBoxInfo());
int headerRow = startRowNum +1 ; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +2;
startRowNum= dataStartRow +2+maps.size();
// 假设表头内容如下:
String headerOne = "采集器序列号";
String[] headersNames = {"序列号"};
String[] headers = {"xlh"};
List<Map<String, Object>> maps = convertList(powerStationEngineeringInfo.getConstructionCollectorBoxInfo());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
......@@ -919,17 +945,18 @@ public class CommonServiceImpl {
int startRowNum = 3;
if (null != extendedInformationDto.getContacts()){
List<Map<String, Object>> maps = convertList(extendedInformationDto.getContacts());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "联系人";
String[] headersNames = {"姓名","关系","联系电话", "电子邮箱", "QQ", "微信"};
String[] headers = {"userName","relation","telephone", "mailbox", "dcpgg", "qq", "wechat"};
List<Map<String, Object>> maps = convertList(extendedInformationDto.getContacts());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
}
......@@ -939,10 +966,11 @@ public class CommonServiceImpl {
int startRowNum = 3;
if (null != powerStationConstructionData.getAreaOrders()){
List<Map<String, Object>> maps = convertListToMap(powerStationConstructionData.getAreaOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "片区运营整改单";
......@@ -950,38 +978,40 @@ public class CommonServiceImpl {
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(powerStationConstructionData.getAreaOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != powerStationConstructionData.getEngineeringOrders()){
List<Map<String, Object>> maps = convertListToMap(powerStationConstructionData.getEngineeringOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "工程整改单";
String[] headersNames = {"整改信息","整改结果","审核结果", "审核意见", "历史审核意见"};
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(powerStationConstructionData.getEngineeringOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != powerStationConstructionData.getDesignOrders()){
List<Map<String, Object>> maps = convertListToMap(powerStationConstructionData.getDesignOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "设计整改单";
String[] headersNames = {"整改信息","整改结果","审核结果", "审核意见", "历史审核意见"};
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(powerStationConstructionData.getDesignOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
}
......@@ -992,10 +1022,11 @@ public class CommonServiceImpl {
int startRowNum = 3;
if (null != hygfOnGrid.getAreaOrders()){
List<Map<String, Object>> maps = convertListToMap(hygfOnGrid.getAreaOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "片区运营整改单";
......@@ -1003,38 +1034,40 @@ public class CommonServiceImpl {
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(hygfOnGrid.getAreaOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != hygfOnGrid.getEngineeringOrders()){
List<Map<String, Object>> maps = convertListToMap(hygfOnGrid.getEngineeringOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "工程整改单";
String[] headersNames = {"整改信息","整改结果","审核结果", "审核意见", "历史审核意见"};
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(hygfOnGrid.getEngineeringOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != hygfOnGrid.getDesignOrders()){
List<Map<String, Object>> maps = convertListToMap(hygfOnGrid.getDesignOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "设计整改单";
String[] headersNames = {"整改信息","整改结果","审核结果", "审核意见", "历史审核意见"};
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(hygfOnGrid.getDesignOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
}
......@@ -1044,10 +1077,11 @@ public class CommonServiceImpl {
int startRowNum = 3;
if (null != acceptanceCheck.getAreaOrders()){
List<Map<String, Object>> maps = convertListToMap(acceptanceCheck.getAreaOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "片区运营整改单";
......@@ -1055,52 +1089,55 @@ public class CommonServiceImpl {
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(acceptanceCheck.getAreaOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != acceptanceCheck.getFinanceOrders()){
List<Map<String, Object>> maps = convertListToMap(acceptanceCheck.getFinanceOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "投融整改单";
String[] headersNames = {"整改信息","整改结果","审核结果", "审核意见", "历史审核意见"};
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(acceptanceCheck.getFinanceOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != acceptanceCheck.getLegalOrders()){
List<Map<String, Object>> maps = convertListToMap(acceptanceCheck.getLegalOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "法务整改单";
String[] headersNames = {"整改信息","整改结果","审核结果", "审核意见", "历史审核意见"};
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(acceptanceCheck.getLegalOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
if (null != acceptanceCheck.getPropertyOrders()){
List<Map<String, Object>> maps = convertListToMap(acceptanceCheck.getPropertyOrders());
int headerRow = startRowNum + 1; // 表头所在的行
int headerOneRow = startRowNum; // 表头所在的行
int dataStartRow = startRowNum+2; // 数据开始的行
startRowNum= dataStartRow +1;
startRowNum= dataStartRow +1+maps.size();
// 假设表头内容如下:
String headerOne = "资产整改单";
String[] headersNames = {"整改信息","整改结果","审核结果", "审核意见", "历史审核意见"};
String[] headers = {"rectificationIdeas","rectificationResultWeb", "auditResult", "auditIdea", "rectificationHistoryWeb"};
List<Map<String, Object>> maps = convertListToMap(acceptanceCheck.getPropertyOrders());
documentSpecialProcessing(sheet,headerRow,headerOneRow,dataStartRow,headersNames,headers,headerOne,maps);
}
}
......@@ -1644,7 +1681,6 @@ public class CommonServiceImpl {
if(100-value ==0){
redisUtils.del(peasantHouseholdId);
}
return map;
}
}
\ No newline at end of file
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