| | |
| | | @ApiOperation(value = "导出excel表模板") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | //原来的下载模板调用接口 |
| | | String base64String = PDFBinaryUtil.getPDFBinary(configService.selectConfigByKey("default_excelTemplate")); |
| | | if (null != base64String) { |
| | | PDFBinaryUtil.base64StringToPDF(base64String, FileUtil.mkdir(value).getPath() + File.separator + "团体预约Excel模版.xls"); |
| | | String filePath = value + File.separator + "团体预约Excel模版.xls"; |
| | | File f = new File(filePath); |
| | | BufferedInputStream br = null; |
| | | OutputStream out = null; |
| | | FileInputStream fileInputStream = null; |
| | | try { |
| | | fileInputStream = new FileInputStream(f); |
| | | br = new BufferedInputStream(fileInputStream); |
| | | byte[] bs = new byte[1024]; |
| | | int len = 0; |
| | | response.reset(); // 非常重要 |
| | | if (true) { |
| | | // 在线打开方式 |
| | | URL u = new URL("file:///" + filePath); |
| | | //System.out.println(u); |
| | | String contentType = u.openConnection().getContentType(); |
| | | response.setContentType(contentType); |
| | | response.setHeader("Content-Disposition", "inline;filename=团体预约Excel模版.xls"); |
| | | } else { |
| | | // 纯下载方式 |
| | | response.setContentType("application/x-msdownload"); |
| | | response.setContentType("application/pdf;charset=utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=团体预约Excel模版.xls"); |
| | | } |
| | | out = response.getOutputStream(); |
| | | while ((len = br.read(bs)) > 0) { |
| | | out.write(bs, 0, len); |
| | | } |
| | | out.flush(); |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | //System.out.println("pdf处理文件异常" + e); |
| | | } finally { |
| | | if (out != null) { |
| | | try { |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | try { |
| | | String base64String = PDFBinaryUtil.getPDFBinary(value + File.separator + "西安路泰机电科技有限公司.xls"); |
| | | if (null != base64String) { |
| | | PDFBinaryUtil.base64StringToPDF(base64String, FileUtil.mkdir(value).getPath() + File.separator + "团体预约Excel模版.xls"); |
| | | String filePath = value + File.separator + "团体预约Excel模版.xls"; |
| | | File f = new File(filePath); |
| | | BufferedInputStream br = null; |
| | | OutputStream out = null; |
| | | FileInputStream fileInputStream = null; |
| | | try { |
| | | fileInputStream = new FileInputStream(f); |
| | | br = new BufferedInputStream(fileInputStream); |
| | | byte[] bs = new byte[1024]; |
| | | int len = 0; |
| | | response.reset(); // 非常重要 |
| | | if (true) { |
| | | // 在线打开方式 |
| | | URL u = new URL("file:///" + filePath); |
| | | //System.out.println(u); |
| | | String contentType = u.openConnection().getContentType(); |
| | | response.setContentType(contentType); |
| | | response.setHeader("Content-Disposition", "inline;filename=团体预约Excel模版.xls"); |
| | | } else { |
| | | // 纯下载方式 |
| | | response.setContentType("application/x-msdownload"); |
| | | response.setContentType("application/pdf;charset=utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=团体预约Excel模版.xls"); |
| | | } |
| | | out = response.getOutputStream(); |
| | | while ((len = br.read(bs)) > 0) { |
| | | out.write(bs, 0, len); |
| | | } |
| | | out.flush(); |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | //System.out.println("pdf处理文件异常" + e); |
| | | } finally { |
| | | if (out != null) { |
| | | try { |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | ExcelUtils.exportTemplate(response,"团体预约Excel模版",TjReservation.class); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | |
| | | TjReservation reservation = tjReservationService.getById(id); |
| | | if (null != reservation && reservation.getIsExpire() == 2) { |
| | | if (tjReservationService.removeById(id)) { |
| | | transitionService.remove(new LambdaQueryWrapper<TbTransition>().eq(TbTransition::getCusId, reservation.getIdCard())); |
| | | transitionService.remove(new LambdaQueryWrapper<TbTransition>().eq(TbTransition::getCusId, reservation.getIdCard()) |
| | | .isNull(TbTransition::getTjNum)); |
| | | taskService.removeTask(new TjReservationTask(id)); |
| | | } |
| | | } |
| | |
| | | LambdaQueryWrapper<TjGroupingPro> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjGroupingPro::getGroupingId, groupingId); |
| | | List<TjGroupingPro> proList = groupingProService.list(wq); |
| | | if (null != proList && proList.size() > 0) { |
| | | if (null != proList && !proList.isEmpty()) { |
| | | for (TjGroupingPro groupingPro : proList) { |
| | | TjProject project = projectService.getById(groupingPro.getProId()); |
| | | if (null != project) { |
| | | if (project.getProType() == null || project.getProType().equals("")) { |
| | | if (project.getProType() == null || project.getProType().isEmpty()) { |
| | | groupingPro.setProType("2"); |
| | | } else { |
| | | groupingPro.setProType(project.getProType()); |
| | |
| | | return AjaxResult.error("此身份证号: "+reservation.getIdCard()+" 重复,请核对后上传!"); |
| | | |
| | | } |
| | | |
| | | reservation.setName(reservation.getName().replaceAll(" ","").replaceAll(" ","")); |
| | | ids.add(reservation.getIdCard()); |
| | | |
| | | TjDwGrouping dwGrouping = dwGroupingService.getById(reservation.getGroupingId()); |