java生成快递单并调用打印机打印
生成快递单过程中需要生成条形码,生成条形码可参考:https://www.cnblogs.com/linbky/p/12091248.html
下面这段代码生成的快递单是完全符合京东快递的10 x 13尺寸的快递单,业务需求是移动端操作下单,提交并同步打印快递单。
package com.yutong.common.utils.print; import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.ImageObserver;
import java.awt.print.Book;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.util.Date; import javax.imageio.ImageIO;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.HashAttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.standard.PrinterName; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import com.yutong.common.utils.DateUtils;
import com.yutong.common.utils.StringUtils; public class Graphic implements ImageObserver, Printable{ private static Logger logger = LoggerFactory.getLogger(Graphic.class); private static WayBillReceive wayBillReceive; private static String filePath; @Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { //获取画笔
Graphics2D g2=(Graphics2D) graphics; //设置画笔颜色
g2.setPaint(Color.black); g2.translate(pageFormat.getImageableX(),pageFormat.getImageableY()); Font font=new Font("黑体",Font.BOLD,36);
g2.setFont(font);
//外框 上9.6cm ,270px+10(外边距)
g2.drawLine(10, 10, 280, 10); //10
//外框 左5.4cm 151px+10(外边距)
g2.drawLine(10, 10, 10, 161);
//外框 下
g2.drawLine(10, 161, 280, 161);
//外框 右
g2.drawLine(280, 10, 280, 161); //中间第一横
g2.drawLine(10, 66, 280, 66); //56+10
//中间第二横
g2.drawLine(10, 100, 280, 100);//34+66 //中间第三横
g2.drawLine(10, 117, 280, 117);//17+100
//中间第四横
g2.drawLine(173, 139, 280, 139);//22+117 //中部第一条竖线
g2.drawLine(30, 100, 30, 161);
//中部第二条竖线
g2.drawLine(145, 66, 145, 117);
//中部第三条竖线
g2.drawLine(173, 100, 173, 161);
//中部第四条竖线
g2.drawLine(201, 117, 201, 161); //上半部分
//--------------------------------------------------------
//下半部分 //上
g2.drawLine(10, 179, 280,179); //179
//左
g2.drawLine(10, 179, 10, 299);
//下
g2.drawLine(10, 299, 280, 299);
//右
g2.drawLine(280,179, 280, 299); //中部第一条横线
g2.drawLine(10, 199, 280, 199); //20+179 //中部第二条横线
g2.drawLine(10, 245, 280, 245); //45+199 //中部第三条横线
g2.drawLine(10, 265, 280, 265); //20+245 //中部第四条横线
g2.drawLine(10, 282, 280, 282);//17+265 //中部第一条竖线
g2.drawLine(85, 245, 85, 265);
//中部第二条竖线
g2.drawLine(182, 199, 182, 299);
//中部第三条竖线
g2.drawLine(224, 245, 224, 265); String fileName = StringUtils.getUuid()+".png";
try { font=new Font("黑体",Font.PLAIN,11);
g2.setFont(font);
g2.drawString("众", 268, 22); //包裹号条形码
Image image = ImageIO.read(BarCodeUtil.generateBarCode(wayBillReceive.getDeliveryId()+"-1-1-", filePath+fileName));
g2.drawImage(image, 12, 12, 255, 52, this); font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font);
//重量
g2.drawString((wayBillReceive.getWeight()==null?0.00:wayBillReceive.getWeight().doubleValue())+" KG", 220, 64); //始发地
font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font);
g2.drawString("始发地:"+wayBillReceive.getSourceSortCenterName(), 13, 76);
font=new Font("黑体",Font.BOLD,20);
g2.setFont(font);
g2.drawString(wayBillReceive.getSourceCrossCode()+"-"+wayBillReceive.getSourceTableTrolleyCode(), 20, 95); //目的地
font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font);
g2.drawString("目的地:"+wayBillReceive.getTargetSortCenterName(), 148, 76);
font=new Font("黑体",Font.BOLD,16);
g2.setFont(font);
g2.drawString(wayBillReceive.getSlideNo()+"-"+wayBillReceive.getTargetTableTrolleyCode(), 176, 92); //目的站点
font=new Font("黑体",Font.PLAIN,13);
g2.setFont(font);
g2.drawString(wayBillReceive.getSiteName(), 33, 115); //路区
g2.drawString(wayBillReceive.getRoad(), 148, 115); //包裹序列
g2.drawString("1/1", 195, 115); //客户信息
font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font);
g2.drawString("客", 15, 128);
g2.drawString("户", 15, 138);
g2.drawString("信", 15, 148);
g2.drawString("息", 15, 158); String address = wayBillReceive.getReceiveAddress();
int y = 128;
if(StringUtils.isNotBlank(address)&&address.length()<=15){
g2.drawString(address, 35, 128);
}
if(StringUtils.isNotBlank(address)&&address.length()>15&&address.length()<=30){
g2.drawString(address.substring(0,15), 35, 128);
g2.drawString(address.substring(15,address.length()), 35, 138);
y = 140;
}
if(StringUtils.isNotBlank(address)&&address.length()>30){
g2.drawString(address.substring(0,15), 35, 128);
g2.drawString(address.substring(15,30), 35, 138);
g2.drawString(address.substring(30,address.length()), 35, 148);
y = 150;
}
g2.drawString(wayBillReceive.getReceiveName()+" "+(wayBillReceive.getReceiveTel()==null?"":wayBillReceive.getReceiveTel())+" "+(wayBillReceive.getReceiveMobile()==null?"":wayBillReceive.getReceiveMobile()), 35, y+10);
y=0; //客户签字
g2.drawString("客户", 176,126 );
g2.drawString("签字", 176,136 ); //应收金额
g2.drawString("应收", 176,148 );
g2.drawString("金额", 176,158 );
font=new Font("黑体",Font.PLAIN,10);
g2.setFont(font);
g2.drawString("¥0.00元", 216,152 ); font=new Font("黑体",Font.PLAIN,6);
g2.setFont(font);
//第一个方框下方日期
g2.drawString(DateUtils.format(new Date(), "yyyy-MM-dd"), 175, 170); //第二个框
//运单号
font=new Font("黑体",Font.PLAIN,13);
g2.setFont(font);
g2.drawString("运单号:"+wayBillReceive.getDeliveryId(), 90, 193); //客户信息
font=new Font("黑体",Font.PLAIN,8);
g2.setFont(font);
g2.drawString("收件信息:"+wayBillReceive.getReceiveName()+" "+(wayBillReceive.getReceiveTel()==null?"":wayBillReceive.getReceiveTel())+" "+(wayBillReceive.getReceiveMobile()==null?"":wayBillReceive.getReceiveMobile()), 13, 207); //运单号条形码
fileName = StringUtils.getUuid()+".png";
image = ImageIO.read(BarCodeUtil.generateBarCode(wayBillReceive.getDeliveryId(), filePath+fileName));
g2.drawImage(image, 12, 209, 168, 36, this); //备注
font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font);
y = 208;
String remark = "备注:"+(wayBillReceive.getRemark()==null?"":wayBillReceive.getRemark()); if(StringUtils.isNotBlank(remark)&&remark.length()<=10){
g2.drawString(remark, 184, y);
}
if(StringUtils.isNotBlank(remark)&&remark.length()>10&&remark.length()<=20){
g2.drawString(remark.substring(0,10), 184, y);
y = y+10;
g2.drawString(remark.substring(10,remark.length()), 184, y); }
if(StringUtils.isNotBlank(remark)&&remark.length()>20&&remark.length()<=30){
g2.drawString(remark.substring(0,10), 184, y);
y = y+10;
g2.drawString(remark.substring(10,20), 184, y);
y = y+10;
g2.drawString(remark.substring(20,remark.length()), 184, y);
}
y=0; //次日达、特会送
font=new Font("黑体",Font.BOLD,15);
g2.setFont(font);
g2.drawString((wayBillReceive.getAgingname()==null?"":wayBillReceive.getAgingname()), 25, 260);
g2.drawString("", 95, 260); //寄方信息
font=new Font("黑体",Font.PLAIN,6);
g2.setFont(font);
g2.drawString("寄方信息:"+wayBillReceive.getSenderAddress(), 12, 272);
g2.drawString(wayBillReceive.getSenderName()+" "+(wayBillReceive.getSenderMobile()==null?"":wayBillReceive.getSenderMobile())+" "+(wayBillReceive.getSenderTel()==null?"":wayBillReceive.getSenderTel()), 12, 280); //商家ID、商家订单号
g2.drawString("商家ID:"+wayBillReceive.getCustomerCode(), 185, 272);
g2.drawString("B商家订单号:"+wayBillReceive.getOrderId(), 185, 279); //提示信息
font=new Font("黑体",Font.PLAIN,5);
g2.setFont(font);
g2.drawString("请您确认包裹完好,保留此包裹联时,代表您已经正常签收并确认外包裹完好", 12, 288);
g2.drawString("http://www.jdwl.com 客服电话:400-603-3600", 12, 293); //始发城市
font=new Font("黑体",Font.PLAIN,6);
g2.setFont(font);
g2.drawString("始发城市:", 184, 292);
font=new Font("黑体",Font.PLAIN,10);
g2.setFont(font);
g2.drawString(wayBillReceive.getSendCity(), 214, 293); //最下方的打印日期
font=new Font("黑体",Font.PLAIN,6);
g2.setFont(font);
g2.drawString(DateUtils.format(new Date(), "yyyy-MM-dd"), 183, 305);
g2.dispose();
} catch (Exception e) {
logger.info("打印快递单异常"+e);
} return Printable.PAGE_EXISTS;
} @Override
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
// TODO Auto-generated method stub
return false;
} public synchronized void print(WayBillReceive wbr,String fp){
wayBillReceive = wbr;
filePath = fp;
PrinterJob printerJob=PrinterJob.getPrinterJob(); Book book=new Book(); PageFormat pf = new PageFormat(); //pf.setOrientation(PageFormat.PORTRAIT); Paper p = new Paper(); //A4尺寸 590 x 840 p.setSize(280,317); p.setImageableArea(0,0, 280,317); //
// p.setSize(590,840);
//
// p.setImageableArea(12,12, 590,840); pf.setPaper(p); book.append(new Graphic(), pf); printerJob.setPageable(book); HashAttributeSet hs=new HashAttributeSet(); DocFlavor flavor = DocFlavor.BYTE_ARRAY.PNG; //HPRT PT562(USB) //HPRT PT541(USB) String printerName="HPRT HLP106S";
// String printerName="Canon iR2520 UFRII LT"; hs.add(new PrinterName(printerName, null)); PrintService[] pss = PrintServiceLookup.lookupPrintServices(flavor, hs); if(pss.length>0){ try { printerJob.setPrintService(pss[0]); printerJob.print(); } catch (PrinterException e) { logger.info("打印快递单异常"+e); } } } }
开发过程中不可能每画一部分或者需要调整字体大小都打印一张纸用来测试,因此可以用下面这段代码来实现预览
下面代码中drawLine方法的内容完全可以用上面第一个print方法的代码代替
package com.yutong.common.utils.print; import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.print.PageFormat;
import java.io.IOException;
import java.util.Date; import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants; import com.yutong.common.utils.DateUtils;
import com.yutong.common.utils.StringUtils; public class PrintView extends JPanel { public static void main(String[] args) {
/*
* 在 AWT 的事件队列线程中创建窗口和组件, 确保线程安全,
* 即 组件创建、绘制、事件响应 需要处于同一线程。
*/
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
// 创建窗口对象
MyFrame frame = new MyFrame();
// 显示窗口
frame.setVisible(true);
}
});
} /**
* 窗口
*/
public static class MyFrame extends JFrame { public static final String TITLE = "Java图形绘制"; public static final int WIDTH = 800;
public static final int HEIGHT = 450; public MyFrame() {
super();
initFrame();
} private void initFrame() {
// 设置 窗口标题 和 窗口大小
setTitle(TITLE);
setSize(WIDTH, HEIGHT); // 设置窗口关闭按钮的默认操作(点击关闭时退出进程)
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // 把窗口位置设置到屏幕的中心
setLocationRelativeTo(null); // 设置窗口的内容面板
MyPanel panel = new MyPanel(this);
setContentPane(panel);
} } /**
* 内容面板
*/
public static class MyPanel extends JPanel { private MyFrame frame; public MyPanel(MyFrame frame) {
super();
this.frame = frame;
} /**
* 绘制面板的内容: 创建 JPanel 后会调用一次该方法绘制内容,
* 之后如果数据改变需要重新绘制, 可调用 updateUI() 方法触发
* 系统再次调用该方法绘制更新 JPanel 的内容。
*/
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g); // 重新调用 Graphics 的绘制方法绘制时将自动擦除旧的内容 /* 自行打开下面注释查看各绘制效果 */ // 1. 线段 / 折线
drawLine(g); // 2. 矩形 / 多边形
// drawRect(g); // 3. 圆弧 / 扇形
// drawArc(g); // 4. 椭圆
// drawOval(g); // 5. 图片
// drawImage(g); // 6. 文本
// drawString(g);
} /**
* 1. 线段 / 折线
*/
private void drawLine(Graphics g) {
//获取画笔
Graphics2D g2=(Graphics2D) g.create(); //设置画笔颜色
g2.setPaint(Color.gray);
PageFormat pageFormat = new PageFormat();
g2.translate(pageFormat.getImageableX(),pageFormat.getImageableY()); Font font=new Font("黑体",Font.BOLD,36);
g2.setFont(font);
//外框 上9.6cm ,270px+10(外边距)
g2.drawLine(10, 10, 280, 10); //10
//外框 左5.4cm 151px+10(外边距)
g2.drawLine(10, 10, 10, 161);
//外框 下
g2.drawLine(10, 161, 280, 161);
//外框 右
g2.drawLine(280, 10, 280, 161); //中间第一横
g2.drawLine(10, 66, 280, 66); //56+10
//中间第二横
g2.drawLine(10, 100, 280, 100);//34+66 //中间第三横
g2.drawLine(10, 117, 280, 117);//17+100
//中间第四横
g2.drawLine(173, 139, 280, 139);//22+117 //中部第一条竖线
g2.drawLine(30, 100, 30, 161);
//中部第二条竖线
g2.drawLine(145, 66, 145, 117);
//中部第三条竖线
g2.drawLine(173, 100, 173, 161);
//中部第四条竖线
g2.drawLine(201, 117, 201, 161); //上半部分
//--------------------------------------------------------
//下半部分 //上
g2.drawLine(10, 179, 280,179); //179
//左
g2.drawLine(10, 179, 10, 299);
//下
g2.drawLine(10, 299, 280, 299);
//右
g2.drawLine(280,179, 280, 299); //中部第一条横线
g2.drawLine(10, 199, 280, 199); //20+179 //中部第二条横线
g2.drawLine(10, 245, 280, 245); //45+199 //中部第三条横线
g2.drawLine(10, 265, 280, 265); //20+245 //中部第四条横线
g2.drawLine(10, 282, 280, 282);//17+265 //中部第一条竖线
g2.drawLine(85, 245, 85, 265);
//中部第二条竖线
g2.drawLine(182, 199, 182, 299);
//中部第三条竖线
g2.drawLine(224, 245, 224, 265); g2.setPaint(Color.black); String fileName = StringUtils.getUuid()+".png";
try { font=new Font("黑体",Font.PLAIN,12);
g2.setFont(font);
g2.drawString("众", 268, 22); //包裹号条形码
Image image = ImageIO.read(BarCodeUtil.generateBarCode("JD20191211-1-1", "D://"+fileName));
g2.drawImage(image, 12, 12, 255, 52, this); font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font);
//重量
g2.drawString("0.5 KG", 220, 61); //始发地
font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font);
g2.drawString("始发地:河南郑州", 13, 76);
font=new Font("黑体",Font.BOLD,20);
g2.setFont(font);
g2.drawString("23-CC-K", 40, 95); //目的地
font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font);
g2.drawString("目的地:上海浦东", 148, 76);
font=new Font("黑体",Font.BOLD,20);
g2.setFont(font);
g2.drawString("6-K04", 176, 95); //目的站点
font=new Font("黑体",Font.PLAIN,13);
g2.setFont(font);
g2.drawString("G上海塘桥营业部", 33, 115); //路区
g2.drawString("84", 148, 115); //包裹序列
g2.drawString("包裹序列", 195, 115); //客户信息
font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font);
g2.drawString("客", 15, 128);
g2.drawString("户", 15, 138);
g2.drawString("信", 15, 148);
g2.drawString("息", 15, 158); String address = "河南省郑州市郑东新区上河南省郑州市郑省郑州市";
int y = 128;
if(StringUtils.isNotBlank(address)&&address.length()<=15){
g2.drawString(address, 35, 128);
}
if(StringUtils.isNotBlank(address)&&address.length()>15&&address.length()<=30){
g2.drawString(address.substring(0,15), 35, 128);
g2.drawString(address.substring(15,address.length()), 35, 140);
y = 140;
}
if(StringUtils.isNotBlank(address)&&address.length()>30){
g2.drawString(address.substring(0,15), 35, 128);
g2.drawString(address.substring(15,30), 35, 140);
g2.drawString(address.substring(30,address.length()), 35, 150);
y = 150;
}
g2.drawString("小哪吒 15613223333", 35, y+10);
y=0; //客户签字
g2.drawString("客户", 176,126 );
g2.drawString("签字", 176,136 ); //应收金额
g2.drawString("应收", 176,148 );
g2.drawString("金额", 176,158 );
font=new Font("黑体",Font.PLAIN,10);
g2.setFont(font);
g2.drawString("¥8元", 216,152 ); font=new Font("黑体",Font.PLAIN,6);
g2.setFont(font);
//第一个方框下方日期
g2.drawString(DateUtils.format(new Date(), "yyyy-MM-dd"), 175, 170); //第二个框
//运单号
font=new Font("黑体",Font.PLAIN,13);
g2.setFont(font);
g2.drawString("运单号:JD20191211", 75, 193); //客户信息
font=new Font("黑体",Font.PLAIN,8);
g2.setFont(font);
g2.drawString("收件信息:小哪吒 15612312215", 13, 207); //运单号条形码
fileName = StringUtils.getUuid()+".png";
image = ImageIO.read(BarCodeUtil.generateBarCode("JD20191211", "D://"+fileName));
g2.drawImage(image, 12, 209, 168, 36, this); //备注
font=new Font("黑体",Font.PLAIN,9);
g2.setFont(font); y = 208;
String remark = "备注:"+"热力裤为了任务了了离开的苟富贵丰东接口健康快乐"; if(StringUtils.isNotBlank(remark)&&remark.length()<=10){
g2.drawString(remark, 184, y);
}
if(StringUtils.isNotBlank(remark)&&remark.length()>10&&remark.length()<=20){
g2.drawString(remark.substring(0,10), 184, y);
y = y+10;
g2.drawString(remark.substring(10,remark.length()), 184, y); }
if(StringUtils.isNotBlank(remark)&&remark.length()>20&&remark.length()<=30){
g2.drawString(remark.substring(0,10), 184, y);
y = y+10;
g2.drawString(remark.substring(10,20), 184, y);
y = y+10;
g2.drawString(remark.substring(20,remark.length()), 184, y);
}
y=0; //次日达、特会送
font=new Font("黑体",Font.BOLD,15);
g2.setFont(font);
g2.drawString("次日达", 25, 260);
g2.drawString("特惠送", 95, 260); //寄方信息
font=new Font("黑体",Font.PLAIN,6);
g2.setFont(font);
g2.drawString("寄方信息:河南省郑州市中原区西流湖小河边", 12, 272);
g2.drawString("小敖丙 18956562321", 12, 280); //商家ID、商家订单号
g2.drawString("商家ID:021K56554545", 185, 272);
g2.drawString("B商家订单号:8965466", 185, 279); //提示信息
font=new Font("黑体",Font.PLAIN,5);
g2.setFont(font);
g2.drawString("请您确认包裹完好,保留此包裹联时,代表您已经正常签收并确认外包裹完好", 12, 288);
g2.drawString("http://www.jdwl.com 客服电话:400-603-3600", 12, 293); //始发城市
font=new Font("黑体",Font.PLAIN,6);
g2.setFont(font);
g2.drawString("始发城市:", 184, 292);
font=new Font("黑体",Font.PLAIN,10);
g2.setFont(font);
g2.drawString("郑州市", 214, 293); //最下方的打印日期
font=new Font("黑体",Font.PLAIN,6);
g2.setFont(font);
g2.drawString(DateUtils.format(new Date(), "yyyy-MM-dd"), 183, 305); } catch (IOException e) {
// TODO Auto-generated catch blo
e.printStackTrace();
} g2.dispose();
}
} }
java生成快递单并调用打印机打印的更多相关文章
- Java jacob调用打印机打印word文档
前面说了Java如何生成复杂的Word文档,今年记录下Java如何调用打印机打印word文档. 起初用的是自带的PrintJob,但是系统提供的打印机制并不成熟完整.网上的代码也是千篇一律,在我的打印 ...
- C# 调用打印机打印文件
C# 调用打印机打印文件,通常情况下,例如Word.Excel.PDF等可以使用一些对应的组件进行打印,另一个通用的方式是直接启用一个打印的进程进行打印.示例代码如下: using System.Di ...
- aspose调用打印机打印文档
aspose很不错的插件,功能非常强大,用到了其中的aspose.word. 如何生成word文档,点击. 下面说说如何如何通过打印机打印文档. aspose提供了一个print方法,通过该方法可以直 ...
- java 调用打印机 打印服务
import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import javax ...
- Java调用打印机打印指定路径图片
依赖 javax.print package com.xgt.util; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; ...
- Java生成 Word文档的并打印解决方案
户要求用程序生成标准的word文档,要能打印,而且不能变形,以前用过很多解决方案,都在客户严格要求下牺牲的无比惨烈. POI读word文档还行,写文档实在不敢恭维,复杂的样式很难控制不提,想象一下一个 ...
- C# 调用打印机 打印 Excel
打印 Excel 模板 大体思路,通过NPOI操作Excel文件,通过Spire将Excel转成图片,将图片传给系统打印. Spire是收费工具,在微软库中下载Free版本. #region 打印所用 ...
- js调用打印机打印
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js调用打印机 打印整体或部分
有时前端的项目中需要添加打印的功能,首先要知道打印分为整体打印和局部打印两种,而局部打印又可细分为局部打印指定的部分,和局部打印指定部分之外的部分.实例比文字看起来更清晰,下面我将用代码来描述 1.整 ...
随机推荐
- CSS3订单提交按钮Loading代码
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"& ...
- JavaScript 利用 filter+正则表达式对 list进行过滤包括模糊匹配
模糊查找 this.users.filter((item)=>{ var reg= new RegExp(this.searchText,'i'); return reg.test(item ...
- 【CDN+】 Hbase入门 以及Hbase shell基础命令
前言 大数据的基础离不开Hbase, 本文就hbase的基础概念,特点,以及框架进行简介, 实际操作种需要注意hbase shell的使用. Hbase 基础 官网:https://hbase.ap ...
- Mybatis入门之MyBatis基础
一.MyBatis概述 1.ORM模型简介 ORM:对象关系映射(Object Relation Mapping) 1)传统JDBC程序的设计缺陷(实际项目不使用) a.大量配置信息硬编码 b.大量的 ...
- (appium+python)UI自动化_10_adb常用命令
前言 adb(Android Debug Bridge)工具是android-sdk里的一个工具,是一个命令行窗口,用于通过电脑端与模拟器或者真实设备交互.在app自动化测试过程中,有时要用到adb命 ...
- Convolutional Neural Networks(1): Architecture
Concolutional Neural Networks(CNN)同样使用三层结构,但结构上同Feedforward Neural Network有很大不同,其结构如下图: Input layer: ...
- app自动化appium使用内置adb命令
一.Appium-server使用 1.登陆页面 高级设置:可以设置Android 和 IOS 日志级别:dabug非常详尽的日志 记录python代码向他发送的请求以及他在收到请求后做的一系列处理 ...
- 2019牛客暑期多校训练营(第二场) - H - Second Large Rectangle - dp
https://ac.nowcoder.com/acm/contest/882/H 正确的办法:dp1[i][j]表示以i,j为底的矩形的高.得到dp1之后,dp2[i][j]表示以dp1[i][j] ...
- 关于JSON.stringify()与JSON.parse()
一.JSON.stringify()与JSON.parse()的区别 JSON.stringify()的作用是将js值转换成JSON字符串,而JSON.parse()是将JSON字符串转换成一个对象. ...
- ls命令输出文件的绝对路径
find $PWD | xargs ls -ld 再结合 grep 筛选