|
@@ -20,9 +20,13 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
|
|
//import com.itextpdf.tool.xml.XMLWorkerHelper;
|
|
|
//import com.itextpdf.text.Document;
|
|
|
//import com.itextpdf.text.pdf.PdfWriter;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.google.common.base.Strings;
|
|
|
import org.jeecg.modules.admin.entity.AdminPlatform;
|
|
|
import org.jeecg.modules.admin.service.IAdminPlatformService;
|
|
|
+import org.jeecg.modules.admin_file_export.entity.AdminFileExport;
|
|
|
+import org.jeecg.modules.admin_file_export.service.IAdminFileExportService;
|
|
|
import org.jeecg.modules.admin_order.entity.AdminOrderExamine2;
|
|
|
import org.jeecg.modules.api.AddWatermarkToPDF;
|
|
|
import org.jeecg.modules.api.HtmlToPdf;
|
|
@@ -43,6 +47,7 @@ import org.jeecg.modules.admin_order.vo.AdminOrderPage;
|
|
|
import org.jeecg.modules.admin_order.service.IAdminOrderService;
|
|
|
import org.jeecg.modules.admin_order.service.IAdminOrderExamineService;
|
|
|
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
@@ -82,6 +87,9 @@ public class AdminOrderController {
|
|
|
@Autowired
|
|
|
private IAdminPlatformService adminPlatformService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IAdminFileExportService adminFileExportService;
|
|
|
+
|
|
|
@Value("${airport.system.host:http://120.79.86.50:9999/airport}")
|
|
|
private String systemHost;
|
|
|
|
|
@@ -102,28 +110,29 @@ public class AdminOrderController {
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
HttpServletRequest req, String ssaircraftNum, String ssaircraftPositionNum, String ssflightNum, String sCDateTime, String eCDateTime) {
|
|
|
- QueryWrapper<AdminOrder> queryWrapper = QueryGenerator.initQueryWrapper( adminOrder, req.getParameterMap() );
|
|
|
+ QueryWrapper<AdminOrder> queryWrapper = QueryGenerator.initQueryWrapper(adminOrder, req.getParameterMap());
|
|
|
if (ssaircraftNum != null) {
|
|
|
- queryWrapper.like( "aircraft_num", ssaircraftNum );
|
|
|
+ queryWrapper.like("aircraft_num", ssaircraftNum);
|
|
|
}
|
|
|
if (ssaircraftPositionNum != null) {
|
|
|
- queryWrapper.like( "aircraft_position_num", ssaircraftPositionNum );
|
|
|
+ queryWrapper.like("aircraft_position_num", ssaircraftPositionNum);
|
|
|
}
|
|
|
if (ssflightNum != null) {
|
|
|
- queryWrapper.like( "flight_num", ssflightNum );
|
|
|
+ queryWrapper.like("flight_num", ssflightNum);
|
|
|
}
|
|
|
- if (!Strings.isNullOrEmpty(sCDateTime)){
|
|
|
- queryWrapper.ge("create_time",sCDateTime + " 00:00:00");
|
|
|
+ if (!Strings.isNullOrEmpty(sCDateTime)) {
|
|
|
+ queryWrapper.ge("create_time", sCDateTime + " 00:00:00");
|
|
|
}
|
|
|
- if (!Strings.isNullOrEmpty(eCDateTime)){
|
|
|
- queryWrapper.le("create_time",eCDateTime + " 23:59:59");
|
|
|
+ if (!Strings.isNullOrEmpty(eCDateTime)) {
|
|
|
+ queryWrapper.le("create_time", eCDateTime + " 23:59:59");
|
|
|
}
|
|
|
- Page<AdminOrder> page = new Page<AdminOrder>( pageNo, pageSize );
|
|
|
- IPage<AdminOrder> pageList = adminOrderService.page( page, queryWrapper );
|
|
|
- return Result.OK( pageList );
|
|
|
+ Page<AdminOrder> page = new Page<AdminOrder>(pageNo, pageSize);
|
|
|
+ IPage<AdminOrder> pageList = adminOrderService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ @AutoLog(value = "订单管理-分页列表导出PDF不添加导出任务")
|
|
|
+ @ApiOperation(value = "订单管理-分页列表导出PDF不添加导出任务", notes = "订单管理-分页列表查询")
|
|
|
@RequestMapping(value = "/dcPDF/{id}", method = {RequestMethod.POST})
|
|
|
public Result<?> dcPDF(@PathVariable String id) {
|
|
|
String fileName = "";
|
|
@@ -196,18 +205,10 @@ public class AdminOrderController {
|
|
|
HtmlToPdf.convert( outputFolderHtml, outputFolder );
|
|
|
|
|
|
// AddWatermarkToPDF.convert(fileName,"temp\\sy.png");
|
|
|
- Date qifeiTime = byId.getQifeiTime();
|
|
|
- if (qifeiTime == null) {
|
|
|
- if ("交接结束".equals(byId.getType())){
|
|
|
- qifeiTime = byId.getUpdateTime();
|
|
|
- } else {
|
|
|
- qifeiTime = byId.getUpdateTime();
|
|
|
- }
|
|
|
- }
|
|
|
- long after24HoursInMillis = qifeiTime.getTime() + 24 * 60 * 60 * 1000; // 将毫秒数增加 24 小时
|
|
|
+ long after24HoursInMillis = byId.getQifeiTime().getTime() + 24 * 60 * 60 * 1000; // 将毫秒数增加 24 小时
|
|
|
Date after24Hours = new Date(after24HoursInMillis);
|
|
|
if (after24Hours.before(new Date( ))) {
|
|
|
- //打印加水印
|
|
|
+ //打印加水印
|
|
|
AddWatermarkToPDF.convert(fileName,adminPlatform.getSy());
|
|
|
}else {
|
|
|
fileName = systemHost+"/sys/common/static/tempFile/" + fileName;
|
|
@@ -223,6 +224,155 @@ public class AdminOrderController {
|
|
|
return Result.OK( fileName );
|
|
|
}
|
|
|
|
|
|
+ @AutoLog(value = "订单管理-分页列表导出PDF")
|
|
|
+ @ApiOperation(value = "订单管理-分页列表导出PDF", notes = "订单管理-分页列表查询")
|
|
|
+ @RequestMapping(value = "/exportPdf/{id}", method = {RequestMethod.POST})
|
|
|
+ public Result<?> exportPdf(@PathVariable String id) {
|
|
|
+ String fileName = "";
|
|
|
+ String fileNameQ = "";
|
|
|
+ String fileNameHtml = "";
|
|
|
+ AdminFileExport adminFileExport = getAdminFileExport(id);
|
|
|
+ adminFileExport.setExportParam(id);
|
|
|
+ adminFileExport.setExportStatus("1");
|
|
|
+ adminFileExport.setExportType("AdminOrderList");
|
|
|
+ adminFileExport.setFileNum(1);
|
|
|
+ try {
|
|
|
+ QueryWrapper<AdminOrderExamine> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("order_id", id);
|
|
|
+ List<AdminOrderExamine> list = adminOrderExamineService.list(queryWrapper);
|
|
|
+ if (list.size() == 0) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
+ AdminOrder byId = adminOrderService.getById(id);
|
|
|
+
|
|
|
+ //fileNameQ = id + "_" + System.currentTimeMillis();
|
|
|
+ fileNameQ = yyyyMMdd.format(byId.getCreateTime()) + "-" + byId.getAircraftNum();
|
|
|
+ fileName = fileNameQ + ".pdf";
|
|
|
+ fileNameHtml = fileNameQ + ".html";
|
|
|
+ adminFileExport.setName(fileName);
|
|
|
+
|
|
|
+// String outputFolder = "D:\\AJeecgBootFiles\\" + fileName;
|
|
|
+// String outputFolderHtml = "D:\\AJeecgBootFiles\\" + fileNameHtml;
|
|
|
+
|
|
|
+ String outputFolder = AirportUtil.getLocalUploadTempPath() + "/" + fileName;
|
|
|
+ String outputFolderHtml = AirportUtil.getLocalUploadTempPath() + "/" + fileNameHtml;
|
|
|
+
|
|
|
+// String outputFolderPic = "/usr/java/AJeecgBootFiles/" + fileNameQ+".png";
|
|
|
+// OutputStream outputStream = Files.newOutputStream( Paths.get( outputFolder ) );
|
|
|
+ //获取水印
|
|
|
+ List<AdminPlatform> adminPlatformList = adminPlatformService.list();
|
|
|
+ AdminPlatform adminPlatform = adminPlatformList.get(0);
|
|
|
+
|
|
|
+ Context context = new Context();
|
|
|
+ //订单号
|
|
|
+ context.setVariable("OrderNum", byId.getOrderNum());
|
|
|
+ //飞机号
|
|
|
+ context.setVariable("AircraftNum", byId.getAircraftNum());
|
|
|
+ //航班号
|
|
|
+ context.setVariable("FlightNum", byId.getFlightNum());
|
|
|
+ //落地机位
|
|
|
+ context.setVariable("AircraftPositionNum", byId.getAircraftPositionNum());
|
|
|
+
|
|
|
+// context.setVariable( "sy", "temp/sy.png" );
|
|
|
+ //创建时间
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ context.setVariable("Time", sdf.format(byId.getCreateTime()));
|
|
|
+// context.setVariable( "order", byId );
|
|
|
+ //阶段数据
|
|
|
+ List<AdminOrderExamine2> list2 = new ArrayList<>();
|
|
|
+ for (AdminOrderExamine main : list) {
|
|
|
+ AdminOrderExamine2 vo = new AdminOrderExamine2();
|
|
|
+ BeanUtils.copyProperties(main, vo);
|
|
|
+ String[] arrPic = main.getPic().split(",");
|
|
|
+ String[] arrExamineYes = main.getExamineYes().split(",");
|
|
|
+ vo.setPic(arrPic);
|
|
|
+ vo.setExamineYes(arrExamineYes);
|
|
|
+ list2.add(vo);
|
|
|
+ }
|
|
|
+ context.setVariable("date", list2);
|
|
|
+ context.setVariable("SystemHost", systemHost);
|
|
|
+
|
|
|
+ String htmlStr = templateEngine.process("template", context);
|
|
|
+
|
|
|
+// // 创建一个新的HTML文件
|
|
|
+ FileWriter writer = new FileWriter(outputFolderHtml);
|
|
|
+ // 写入HTML代码
|
|
|
+ writer.write(htmlStr);
|
|
|
+ // 关闭文件写入器
|
|
|
+ writer.close();
|
|
|
+ HtmlToPdf.convert(outputFolderHtml, outputFolder);
|
|
|
+ File file = new File(outputFolder);
|
|
|
+ adminFileExport.setFileSize(file.exists() ? file.length() : 0);
|
|
|
+
|
|
|
+// AddWatermarkToPDF.convert(fileName,"temp\\sy.png");
|
|
|
+ Date qifeiTime = byId.getQifeiTime();
|
|
|
+ if (qifeiTime == null) {
|
|
|
+ if ("交接结束".equals(byId.getType())) {
|
|
|
+ qifeiTime = byId.getUpdateTime();
|
|
|
+ } else {
|
|
|
+ qifeiTime = byId.getUpdateTime();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ long after24HoursInMillis = qifeiTime.getTime() + 24 * 60 * 60 * 1000; // 将毫秒数增加 24 小时
|
|
|
+ Date after24Hours = new Date(after24HoursInMillis);
|
|
|
+ if (after24Hours.before(new Date())) {
|
|
|
+ //打印加水印
|
|
|
+ AddWatermarkToPDF.convert(fileName, adminPlatform.getSy());
|
|
|
+ } else {
|
|
|
+ fileName = systemHost + "/sys/common/static/tempFile/" + fileName;
|
|
|
+ adminFileExport.setUrl(fileName);
|
|
|
+ adminFileExportService.saveOrUpdate(adminFileExport);
|
|
|
+ return Result.OK(fileName);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ adminFileExport.setExportStatus("2");
|
|
|
+ adminFileExportService.saveOrUpdate(adminFileExport);
|
|
|
+ return Result.error("导出错误");
|
|
|
+ }
|
|
|
+// fileName = "http://127.0.0.1:9999/sys/common/static/sy_" + fileName;
|
|
|
+// fileName = "http://120.79.86.50:9999/sys/common/static/" + fileNameHtml;
|
|
|
+ fileName = systemHost + "/sys/common/static/tempFile/sy_" + fileName;
|
|
|
+ adminFileExport.setUrl(fileName);
|
|
|
+ adminFileExportService.saveOrUpdate(adminFileExport);
|
|
|
+ return Result.OK(fileName);
|
|
|
+ }
|
|
|
+
|
|
|
+ @NotNull
|
|
|
+ private AdminFileExport getAdminFileExport(String id) {
|
|
|
+ LambdaQueryWrapper<AdminFileExport> adminFileExportQueryWrapper = new LambdaQueryWrapper<>(AdminFileExport.class);
|
|
|
+ adminFileExportQueryWrapper.eq(AdminFileExport::getExportParam, id)
|
|
|
+ .eq(AdminFileExport::getFileType,"pdf")
|
|
|
+ .eq(AdminFileExport::getExportType,"AdminOrderList");
|
|
|
+ AdminFileExport adminFileExport = adminFileExportService.getOne(adminFileExportQueryWrapper);
|
|
|
+ if (adminFileExport == null) {
|
|
|
+ adminFileExport = new AdminFileExport();
|
|
|
+ }
|
|
|
+ return adminFileExport;
|
|
|
+ }
|
|
|
+
|
|
|
+ @AutoLog(value = "订单管理-分页列表添加导出多个PDF任务")
|
|
|
+ @ApiOperation(value = "订单管理-分页列表添加导出多个PDF任务", notes = "订单管理-分页列表查询")
|
|
|
+ @RequestMapping(value = "/addExportPdfFilesTask", method = {RequestMethod.POST})
|
|
|
+ public Result<?> addExportPdfFilesTask(@RequestBody String[] orderIds) {
|
|
|
+ /*
|
|
|
+ * id,文件名,任务参数(orderIds),文件url,文件类型,文件大小,导出状态(0:正在导出,1:导出完成),导出文件数量,导出人,导出时间,修改时间
|
|
|
+ * */
|
|
|
+ String fileName = "";
|
|
|
+ String fileNameQ = "";
|
|
|
+ String fileNameHtml = "";
|
|
|
+
|
|
|
+ fileName = fileNameQ + ".pdf";
|
|
|
+ fileNameHtml = fileNameQ + ".html";
|
|
|
+
|
|
|
+ String outputFolder = AirportUtil.getLocalUploadTempPath() + "/" + fileName;
|
|
|
+ String outputFolderHtml = AirportUtil.getLocalUploadTempPath() + "/" + fileNameHtml;
|
|
|
+
|
|
|
+ fileName = systemHost + "/sys/common/static/tempFile/sy_" + fileName;
|
|
|
+ return Result.OK("任务已添加到下载列表", orderIds);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 添加
|
|
|
*
|
|
@@ -234,9 +384,9 @@ public class AdminOrderController {
|
|
|
@PostMapping(value = "/add")
|
|
|
public Result<?> add(@RequestBody AdminOrderPage adminOrderPage) {
|
|
|
AdminOrder adminOrder = new AdminOrder();
|
|
|
- BeanUtils.copyProperties( adminOrderPage, adminOrder );
|
|
|
- adminOrderService.saveMain( adminOrder, adminOrderPage.getAdminOrderExamineList() );
|
|
|
- return Result.OK( "添加成功!" );
|
|
|
+ BeanUtils.copyProperties(adminOrderPage, adminOrder);
|
|
|
+ adminOrderService.saveMain(adminOrder, adminOrderPage.getAdminOrderExamineList());
|
|
|
+ return Result.OK("添加成功!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -250,13 +400,13 @@ public class AdminOrderController {
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
|
public Result<?> edit(@RequestBody AdminOrderPage adminOrderPage) {
|
|
|
AdminOrder adminOrder = new AdminOrder();
|
|
|
- BeanUtils.copyProperties( adminOrderPage, adminOrder );
|
|
|
- AdminOrder adminOrderEntity = adminOrderService.getById( adminOrder.getId() );
|
|
|
+ BeanUtils.copyProperties(adminOrderPage, adminOrder);
|
|
|
+ AdminOrder adminOrderEntity = adminOrderService.getById(adminOrder.getId());
|
|
|
if (adminOrderEntity == null) {
|
|
|
- return Result.error( "未找到对应数据" );
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
}
|
|
|
- adminOrderService.updateMain( adminOrder, adminOrderPage.getAdminOrderExamineList() );
|
|
|
- return Result.OK( "编辑成功!" );
|
|
|
+ adminOrderService.updateMain(adminOrder, adminOrderPage.getAdminOrderExamineList());
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -269,8 +419,8 @@ public class AdminOrderController {
|
|
|
@ApiOperation(value = "订单管理-通过id删除", notes = "订单管理-通过id删除")
|
|
|
@DeleteMapping(value = "/delete")
|
|
|
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
- adminOrderService.delMain( id );
|
|
|
- return Result.OK( "删除成功!" );
|
|
|
+ adminOrderService.delMain(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -283,8 +433,8 @@ public class AdminOrderController {
|
|
|
@ApiOperation(value = "订单管理-批量删除", notes = "订单管理-批量删除")
|
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
|
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
- this.adminOrderService.delBatchMain( Arrays.asList( ids.split( "," ) ) );
|
|
|
- return Result.OK( "批量删除成功!" );
|
|
|
+ this.adminOrderService.delBatchMain(Arrays.asList(ids.split(",")));
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -297,11 +447,11 @@ public class AdminOrderController {
|
|
|
@ApiOperation(value = "订单管理-通过id查询", notes = "订单管理-通过id查询")
|
|
|
@GetMapping(value = "/queryById")
|
|
|
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
- AdminOrder adminOrder = adminOrderService.getById( id );
|
|
|
+ AdminOrder adminOrder = adminOrderService.getById(id);
|
|
|
if (adminOrder == null) {
|
|
|
- return Result.error( "未找到对应数据" );
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
}
|
|
|
- return Result.OK( adminOrder );
|
|
|
+ return Result.OK(adminOrder);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -315,11 +465,11 @@ public class AdminOrderController {
|
|
|
@ApiOperation(value = "安检信息-通过主表ID查询", notes = "安检信息-通过主表ID查询")
|
|
|
@GetMapping(value = "/queryAdminOrderExamineByMainId")
|
|
|
public Result<?> queryAdminOrderExamineListByMainId(@RequestParam(name = "id", required = true) String id) {
|
|
|
- List<AdminOrderExamine> adminOrderExamineList = adminOrderExamineService.selectByMainId( id );
|
|
|
+ List<AdminOrderExamine> adminOrderExamineList = adminOrderExamineService.selectByMainId(id);
|
|
|
IPage<AdminOrderExamine> page = new Page<>();
|
|
|
- page.setRecords( adminOrderExamineList );
|
|
|
- page.setTotal( adminOrderExamineList.size() );
|
|
|
- return Result.OK( page );
|
|
|
+ page.setRecords(adminOrderExamineList);
|
|
|
+ page.setTotal(adminOrderExamineList.size());
|
|
|
+ return Result.OK(page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -331,37 +481,37 @@ public class AdminOrderController {
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
public ModelAndView exportXls(HttpServletRequest request, AdminOrder adminOrder) {
|
|
|
// Step.1 组装查询条件查询数据
|
|
|
- QueryWrapper<AdminOrder> queryWrapper = QueryGenerator.initQueryWrapper( adminOrder, request.getParameterMap() );
|
|
|
+ QueryWrapper<AdminOrder> queryWrapper = QueryGenerator.initQueryWrapper(adminOrder, request.getParameterMap());
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
|
//Step.2 获取导出数据
|
|
|
- List<AdminOrder> queryList = adminOrderService.list( queryWrapper );
|
|
|
+ List<AdminOrder> queryList = adminOrderService.list(queryWrapper);
|
|
|
// 过滤选中数据
|
|
|
- String selections = request.getParameter( "selections" );
|
|
|
+ String selections = request.getParameter("selections");
|
|
|
List<AdminOrder> adminOrderList = new ArrayList<AdminOrder>();
|
|
|
- if (oConvertUtils.isEmpty( selections )) {
|
|
|
+ if (oConvertUtils.isEmpty(selections)) {
|
|
|
adminOrderList = queryList;
|
|
|
} else {
|
|
|
- List<String> selectionList = Arrays.asList( selections.split( "," ) );
|
|
|
- adminOrderList = queryList.stream().filter( item -> selectionList.contains( item.getId() ) ).collect( Collectors.toList() );
|
|
|
+ List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
+ adminOrderList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
// Step.3 组装pageList
|
|
|
List<AdminOrderPage> pageList = new ArrayList<AdminOrderPage>();
|
|
|
for (AdminOrder main : adminOrderList) {
|
|
|
AdminOrderPage vo = new AdminOrderPage();
|
|
|
- BeanUtils.copyProperties( main, vo );
|
|
|
- List<AdminOrderExamine> adminOrderExamineList = adminOrderExamineService.selectByMainId( main.getId() );
|
|
|
- vo.setAdminOrderExamineList( adminOrderExamineList );
|
|
|
- pageList.add( vo );
|
|
|
+ BeanUtils.copyProperties(main, vo);
|
|
|
+ List<AdminOrderExamine> adminOrderExamineList = adminOrderExamineService.selectByMainId(main.getId());
|
|
|
+ vo.setAdminOrderExamineList(adminOrderExamineList);
|
|
|
+ pageList.add(vo);
|
|
|
}
|
|
|
|
|
|
// Step.4 AutoPoi 导出Excel
|
|
|
- ModelAndView mv = new ModelAndView( new JeecgEntityExcelView() );
|
|
|
- mv.addObject( NormalExcelConstants.FILE_NAME, "订单管理列表" );
|
|
|
- mv.addObject( NormalExcelConstants.CLASS, AdminOrderPage.class );
|
|
|
- mv.addObject( NormalExcelConstants.PARAMS, new ExportParams( "订单管理数据", "导出人:" + sysUser.getRealname(), "订单管理" ) );
|
|
|
- mv.addObject( NormalExcelConstants.DATA_LIST, pageList );
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, "订单管理列表");
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, AdminOrderPage.class);
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("订单管理数据", "导出人:" + sysUser.getRealname(), "订单管理"));
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
return mv;
|
|
|
}
|
|
|
|
|
@@ -379,20 +529,20 @@ public class AdminOrderController {
|
|
|
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
|
|
MultipartFile file = entity.getValue();// 获取上传文件对象
|
|
|
ImportParams params = new ImportParams();
|
|
|
- params.setTitleRows( 2 );
|
|
|
- params.setHeadRows( 1 );
|
|
|
- params.setNeedSave( true );
|
|
|
+ params.setTitleRows(2);
|
|
|
+ params.setHeadRows(1);
|
|
|
+ params.setNeedSave(true);
|
|
|
try {
|
|
|
- List<AdminOrderPage> list = ExcelImportUtil.importExcel( file.getInputStream(), AdminOrderPage.class, params );
|
|
|
+ List<AdminOrderPage> list = ExcelImportUtil.importExcel(file.getInputStream(), AdminOrderPage.class, params);
|
|
|
for (AdminOrderPage page : list) {
|
|
|
AdminOrder po = new AdminOrder();
|
|
|
- BeanUtils.copyProperties( page, po );
|
|
|
- adminOrderService.saveMain( po, page.getAdminOrderExamineList() );
|
|
|
+ BeanUtils.copyProperties(page, po);
|
|
|
+ adminOrderService.saveMain(po, page.getAdminOrderExamineList());
|
|
|
}
|
|
|
- return Result.OK( "文件导入成功!数据行数:" + list.size() );
|
|
|
+ return Result.OK("文件导入成功!数据行数:" + list.size());
|
|
|
} catch (Exception e) {
|
|
|
- log.error( e.getMessage(), e );
|
|
|
- return Result.error( "文件导入失败:" + e.getMessage() );
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return Result.error("文件导入失败:" + e.getMessage());
|
|
|
} finally {
|
|
|
try {
|
|
|
file.getInputStream().close();
|
|
@@ -401,7 +551,7 @@ public class AdminOrderController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return Result.OK( "文件导入失败!" );
|
|
|
+ return Result.OK("文件导入失败!");
|
|
|
}
|
|
|
|
|
|
}
|