Commit fda92693 authored by hezhuozhi's avatar hezhuozhi

Merge remote-tracking branch 'origin/developer_bw' into developer_bw

parents 2f6f416d 11d5757d
......@@ -58,6 +58,23 @@ public class CommonController {
System.out.println("zip下载成功");
}
/**
* 设备信息下载
*
* @return
*/
@GetMapping(value = "/test")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "资料下载", notes = "资料下载")
public void test(HttpServletResponse response) throws IOException {
// 设置响应头
response.setContentType("application/zip");
commonService.test(response);
System.out.println("zip下载成功");
}
/**
* 设备信息下载
*
......
......@@ -550,13 +550,16 @@ public class CommonServiceImpl {
Path currentWorkingDir = Paths.get("");
// 获取当前工作目录
Path rootDir = currentWorkingDir;
Path ziLiaoDir =rootDir.resolve("批量资料");
Path ziLiaoDir = createUniqueDirectory(rootDir, "批量资料");
// 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(redisKey, MapBuilder.<String, Object>create()
.put("value", current).build());
if (!redisKey.contains(",")){
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", currentBili).build());
}
String powerStationInstanceId = powerStationMapper.getInstanceIdByhouseId(peasantHouseholdId);
String financingInstanceId = financingAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
List<LinkedHashMap> powerStationWorkLog = new ArrayList<>();
......@@ -654,9 +657,11 @@ public class CommonServiceImpl {
} catch (IOException e) {
e.printStackTrace();
}
current = current + 15 ;
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", current).build());
if (!redisKey.contains(",")){
currentBili = currentBili + 15 ;
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", currentBili).build());
}
List<HygfRectificationOrder> areaOrdersCon =new ArrayList<>();
if (ObjectUtils.isNotEmpty(returnDto.getHygfOnGrid())) {
areaOrdersCon = Optional.ofNullable(returnDto.getPowerStationConstructionData().getAreaOrders())
......@@ -857,20 +862,22 @@ public class CommonServiceImpl {
}
// 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());
if (redisKey.contains(",")){
currentBili = currentBili + baifenbi;
redisUtils.set(redisKey,MapBuilder.<String, Object>create()
.put("value", currentBili).build());
}
}
String encodedFilename = "";
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
if (peasantHouseholdIds.size() > 1){
fileName = "批量资料";
encodedFilename = URLEncoder.encode( "批量资料.zip", StandardCharsets.UTF_8.name());
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName+".zip", "UTF-8"));
createZipFile(ziLiaoDir, fileName,response);
}else {
encodedFilename = URLEncoder.encode( fileName+".zip", StandardCharsets.UTF_8.name());
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName+".zip", "UTF-8"));
createZipFile(ziLiaoDir, "批量资料/"+fileName,response);
}
......@@ -881,6 +888,16 @@ public class CommonServiceImpl {
cleanup(ziLiaoDir);
}
public void test (HttpServletResponse response) throws UnsupportedEncodingException {
String fileName = "批量资料";
Path currentWorkingDir = Paths.get("");
// 获取当前工作目录
Path rootDir = currentWorkingDir;
Path ziLiaoDir =rootDir.resolve("批量资料");
String encodedFilename = URLEncoder.encode( fileName+".zip", StandardCharsets.UTF_8.name());
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName+".zip", "UTF-8"));
createZipFile(ziLiaoDir, "批量资料",response);
}
private void fillSheet(Sheet sheet, Object data) {
if (Objects.isNull(data)){
......
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