|
@@ -140,13 +140,13 @@ public class AdminOrderController {
|
|
String fileNameHtml = "";
|
|
String fileNameHtml = "";
|
|
try {
|
|
try {
|
|
QueryWrapper<AdminOrderExamine> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<AdminOrderExamine> queryWrapper = new QueryWrapper<>();
|
|
- queryWrapper.eq( "order_id", id );
|
|
|
|
- List<AdminOrderExamine> list = adminOrderExamineService.list( queryWrapper );
|
|
|
|
|
|
+ queryWrapper.eq("order_id", id);
|
|
|
|
+ List<AdminOrderExamine> list = adminOrderExamineService.list(queryWrapper);
|
|
if (list.size() == 0) {
|
|
if (list.size() == 0) {
|
|
- return Result.error( "未找到对应数据" );
|
|
|
|
|
|
+ return Result.error("未找到对应数据");
|
|
}
|
|
}
|
|
SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
|
|
SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
|
|
- AdminOrder byId = adminOrderService.getById( id );
|
|
|
|
|
|
+ AdminOrder byId = adminOrderService.getById(id);
|
|
|
|
|
|
//fileNameQ = id + "_" + System.currentTimeMillis();
|
|
//fileNameQ = id + "_" + System.currentTimeMillis();
|
|
fileNameQ = yyyyMMdd.format(byId.getCreateTime()) + "-" + byId.getAircraftNum();
|
|
fileNameQ = yyyyMMdd.format(byId.getCreateTime()) + "-" + byId.getAircraftNum();
|
|
@@ -163,38 +163,38 @@ public class AdminOrderController {
|
|
// OutputStream outputStream = Files.newOutputStream( Paths.get( outputFolder ) );
|
|
// OutputStream outputStream = Files.newOutputStream( Paths.get( outputFolder ) );
|
|
//获取水印
|
|
//获取水印
|
|
List<AdminPlatform> adminPlatformList = adminPlatformService.list();
|
|
List<AdminPlatform> adminPlatformList = adminPlatformService.list();
|
|
- AdminPlatform adminPlatform = adminPlatformList.get( 0 );
|
|
|
|
|
|
+ AdminPlatform adminPlatform = adminPlatformList.get(0);
|
|
|
|
|
|
Context context = new Context();
|
|
Context context = new Context();
|
|
//订单号
|
|
//订单号
|
|
- context.setVariable( "OrderNum", byId.getOrderNum() );
|
|
|
|
|
|
+ context.setVariable("OrderNum", byId.getOrderNum());
|
|
//飞机号
|
|
//飞机号
|
|
- context.setVariable( "AircraftNum", byId.getAircraftNum() );
|
|
|
|
|
|
+ context.setVariable("AircraftNum", byId.getAircraftNum());
|
|
//航班号
|
|
//航班号
|
|
- context.setVariable( "FlightNum", byId.getFlightNum() );
|
|
|
|
|
|
+ context.setVariable("FlightNum", byId.getFlightNum());
|
|
//落地机位
|
|
//落地机位
|
|
- context.setVariable( "AircraftPositionNum", byId.getAircraftPositionNum() );
|
|
|
|
|
|
+ context.setVariable("AircraftPositionNum", byId.getAircraftPositionNum());
|
|
|
|
|
|
// context.setVariable( "sy", "temp/sy.png" );
|
|
// context.setVariable( "sy", "temp/sy.png" );
|
|
//创建时间
|
|
//创建时间
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
- context.setVariable( "Time", sdf.format( byId.getCreateTime() ) );
|
|
|
|
|
|
+ context.setVariable("Time", sdf.format(byId.getCreateTime()));
|
|
// context.setVariable( "order", byId );
|
|
// context.setVariable( "order", byId );
|
|
//阶段数据
|
|
//阶段数据
|
|
- List<AdminOrderExamine2> list2 = new ArrayList<>( );
|
|
|
|
|
|
+ List<AdminOrderExamine2> list2 = new ArrayList<>();
|
|
for (AdminOrderExamine main : list) {
|
|
for (AdminOrderExamine main : list) {
|
|
AdminOrderExamine2 vo = new AdminOrderExamine2();
|
|
AdminOrderExamine2 vo = new AdminOrderExamine2();
|
|
- BeanUtils.copyProperties( main, vo );
|
|
|
|
|
|
+ BeanUtils.copyProperties(main, vo);
|
|
String[] arrPic = main.getPic().split(",");
|
|
String[] arrPic = main.getPic().split(",");
|
|
String[] arrExamineYes = main.getExamineYes().split(",");
|
|
String[] arrExamineYes = main.getExamineYes().split(",");
|
|
- vo.setPic( arrPic );
|
|
|
|
- vo.setExamineYes( arrExamineYes );
|
|
|
|
- list2.add( vo );
|
|
|
|
|
|
+ vo.setPic(arrPic);
|
|
|
|
+ vo.setExamineYes(arrExamineYes);
|
|
|
|
+ list2.add(vo);
|
|
}
|
|
}
|
|
- context.setVariable( "date", list2 );
|
|
|
|
- context.setVariable( "SystemHost", systemHost );
|
|
|
|
|
|
+ context.setVariable("date", list2);
|
|
|
|
+ context.setVariable("SystemHost", systemHost);
|
|
|
|
|
|
- String htmlStr = templateEngine.process( "template", context );
|
|
|
|
|
|
+ String htmlStr = templateEngine.process("template", context);
|
|
|
|
|
|
// // 创建一个新的HTML文件
|
|
// // 创建一个新的HTML文件
|
|
FileWriter writer = new FileWriter(outputFolderHtml);
|
|
FileWriter writer = new FileWriter(outputFolderHtml);
|
|
@@ -202,26 +202,26 @@ public class AdminOrderController {
|
|
writer.write(htmlStr);
|
|
writer.write(htmlStr);
|
|
// 关闭文件写入器
|
|
// 关闭文件写入器
|
|
writer.close();
|
|
writer.close();
|
|
- HtmlToPdf.convert( outputFolderHtml, outputFolder );
|
|
|
|
|
|
+ HtmlToPdf.convert(outputFolderHtml, outputFolder);
|
|
|
|
|
|
// AddWatermarkToPDF.convert(fileName,"temp\\sy.png");
|
|
// AddWatermarkToPDF.convert(fileName,"temp\\sy.png");
|
|
long after24HoursInMillis = byId.getQifeiTime().getTime() + 24 * 60 * 60 * 1000; // 将毫秒数增加 24 小时
|
|
long after24HoursInMillis = byId.getQifeiTime().getTime() + 24 * 60 * 60 * 1000; // 将毫秒数增加 24 小时
|
|
Date after24Hours = new Date(after24HoursInMillis);
|
|
Date after24Hours = new Date(after24HoursInMillis);
|
|
- if (after24Hours.before(new Date( ))) {
|
|
|
|
|
|
+ if (after24Hours.before(new Date())) {
|
|
//打印加水印
|
|
//打印加水印
|
|
- AddWatermarkToPDF.convert(fileName,adminPlatform.getSy());
|
|
|
|
- }else {
|
|
|
|
- fileName = systemHost+"/sys/common/static/tempFile/" + fileName;
|
|
|
|
- return Result.OK( fileName );
|
|
|
|
|
|
+ AddWatermarkToPDF.convert(fileName, adminPlatform.getSy());
|
|
|
|
+ } else {
|
|
|
|
+ fileName = systemHost + "/sys/common/static/tempFile/" + fileName;
|
|
|
|
+ return Result.OK(fileName);
|
|
}
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- return Result.error( "导出错误" );
|
|
|
|
|
|
+ return Result.error("导出错误");
|
|
}
|
|
}
|
|
// fileName = "http://127.0.0.1:9999/sys/common/static/sy_" + fileName;
|
|
// fileName = "http://127.0.0.1:9999/sys/common/static/sy_" + fileName;
|
|
// fileName = "http://120.79.86.50:9999/sys/common/static/" + fileNameHtml;
|
|
// fileName = "http://120.79.86.50:9999/sys/common/static/" + fileNameHtml;
|
|
- fileName = systemHost+"/sys/common/static/tempFile/sy_" + fileName;
|
|
|
|
- return Result.OK( fileName );
|
|
|
|
|
|
+ fileName = systemHost + "/sys/common/static/tempFile/sy_" + fileName;
|
|
|
|
+ return Result.OK(fileName);
|
|
}
|
|
}
|
|
|
|
|
|
@AutoLog(value = "订单管理-分页列表导出PDF")
|
|
@AutoLog(value = "订单管理-分页列表导出PDF")
|
|
@@ -344,7 +344,7 @@ public class AdminOrderController {
|
|
|
|
|
|
private void deleteFile(String outputFolderHtml) {
|
|
private void deleteFile(String outputFolderHtml) {
|
|
File file1 = new File(outputFolderHtml);
|
|
File file1 = new File(outputFolderHtml);
|
|
- if (file1.exists()){
|
|
|
|
|
|
+ if (file1.exists()) {
|
|
file1.delete();
|
|
file1.delete();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -353,7 +353,7 @@ public class AdminOrderController {
|
|
@ApiOperation(value = "订单管理-分页列表添加导出多个PDF任务", notes = "订单管理-分页列表查询")
|
|
@ApiOperation(value = "订单管理-分页列表添加导出多个PDF任务", notes = "订单管理-分页列表查询")
|
|
@RequestMapping(value = "/addExportPdfFilesTask", method = {RequestMethod.POST})
|
|
@RequestMapping(value = "/addExportPdfFilesTask", method = {RequestMethod.POST})
|
|
public Result<?> addExportPdfFilesTask(@RequestBody String[] orderIds) {
|
|
public Result<?> addExportPdfFilesTask(@RequestBody String[] orderIds) {
|
|
- if (orderIds == null || orderIds.length <=0) {
|
|
|
|
|
|
+ if (orderIds == null || orderIds.length <= 0) {
|
|
return Result.error("请选择订单");
|
|
return Result.error("请选择订单");
|
|
}
|
|
}
|
|
boolean r = adminOrderService.addExportPdfFilesTask(Arrays.asList(orderIds));
|
|
boolean r = adminOrderService.addExportPdfFilesTask(Arrays.asList(orderIds));
|