jmeter针对订单做导出功能(根据接口返回字段进行筛选导出)

重点1:正则表达式提取需要导出的值

重点2:后置处理器的BeanShell PostProcessor进行脚本编写

String a = "截止17点";
String b = "${__time(dd,)}日";
String path = "G:/data/"+b+"订单数据导出"+a+".csv";
String orderStatus = vars.get("orderStatus");
String type;
//根据订单状态码进行对应文案转换
if(orderStatus.equals("1"))
{
type = "待付款";
}else if(orderStatus.equals("2"))
{
	type = "订单待审核";
}else if(orderStatus.equals("3"))
{
	type = "车辆待维护";
}else if(orderStatus.equals("4"))
{
	type = "物流询价中";
}else if(orderStatus.equals("5"))
{
	type = "待提货";
}else if(orderStatus.equals("6"))
{
	type = "提货中";
}else if(orderStatus.equals("7"))
{
	type = "已完成";
}else if(orderStatus.equals("8"))
{
	type = "换货";
}else if(orderStatus.equals("9"))
{
	type = "退货退款";
}else if(orderStatus.equals("10"))
{
	type = "已取消";
}else if(orderStatus.equals("20"))
{
	type = "派单中";
}else if(orderStatus.equals("21"))
{
	type = "初次派单";
}else if(orderStatus.equals("22"))
{
	type = "重新派单中";
}else if(orderStatus.equals("23"))
{
	type = "延期待审核";
}else if(orderStatus.equals("31"))
{
	type = "供应商车辆维护";
}else if(orderStatus.equals("32"))
{
	type = "车辆待维护";
}else if(orderStatus.equals("41"))
{
	type = "物流待支付";
}else if(orderStatus.equals("42"))
{
	type = "询价审核中";
}else if(orderStatus.equals("61"))
{
	type = "运输中";
}else if(orderStatus.equals("62"))
{
	type = "待收货";
}else if(orderStatus.equals("70"))
{
	type = "涨亏吨待处理";
}else if(orderStatus.equals("71"))
{
	type = "涨亏吨待审核";
}else if(orderStatus.equals("91"))
{
	type = "仅退款";
};
//创建文件流
FileWriter fstream = new FileWriter(path, true);

BufferedWriter out = new BufferedWriter(fstream);
//写入数据到文档中 “,”是指换列
out.write( vars.get("consumerName"));

out.write(",");

out.write( vars.get("itemName"));

out.write(",");

out.write( vars.get("itemTotalNum"));

out.write(",");

out.write( vars.get("orderRealNum"));

out.write(",");

out.write(type);
//此处是为了换行
out.write(System.getProperty("line.separator"));
//关闭流
out.close();

fstream.close(); 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值