记得上下班打卡 | git大法好,push需谨慎

Commit 55706e81 authored by jiangxiulong's avatar jiangxiulong

打印

parent 6b1d3645
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
var orderStatusDic = [[${@dict.getType('zhengzai_order_status')}]]; var orderStatusDic = [[${@dict.getType('zhengzai_order_status')}]];
function printAjax(orderExpressId) { function printAjax(orderExpressId) {
var configProvinces = { var configPrint = {
url: prefix + "/print", url: prefix + "/print",
type: "post", type: "post",
dataType: "json", dataType: "json",
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
console.log(result); console.log(result);
} }
}; };
$.ajax(configProvinces) $.ajax(configPrint)
} }
$(function () { $(function () {
......
...@@ -194,11 +194,15 @@ public class CodeUtil { ...@@ -194,11 +194,15 @@ public class CodeUtil {
return returnVal; return returnVal;
} }
public static String html2img(KylinOrderExpress kylinOrderExpress,String jContact, String jAddress, String jTel, KylinOrderTickets orderInfo) public static String html2img(KylinOrderExpress kylinOrderExpress,String jContact, String jAddress, String jTel, KylinOrderTickets orderInfo, int num)
{ {
long s = System.currentTimeMillis();
String barCode = getBarCode(kylinOrderExpress.getMailno(), 90, 13); String barCode = getBarCode(kylinOrderExpress.getMailno(), 90, 13);
logger.debug("#barCode耗时:{}ms", System.currentTimeMillis() - s);
String qrCode = getQRCode(kylinOrderExpress.getTwoDimensionCode(), 25, 25); String qrCode = getQRCode(kylinOrderExpress.getTwoDimensionCode(), 25, 25);
logger.debug("#qrCode耗时:{}ms", System.currentTimeMillis() - s);
String html = tmpHtml(); String html = tmpHtml();
...@@ -224,7 +228,9 @@ public class CodeUtil { ...@@ -224,7 +228,9 @@ public class CodeUtil {
.replace("18510989999", jTel) .replace("18510989999", jTel)
.replace("寄件地址北京市朝阳区摩登天空测试地址", jAddress) .replace("寄件地址北京市朝阳区摩登天空测试地址", jAddress)
; ;
logger.debug("#replace1耗时:{}ms", System.currentTimeMillis() - s);
Html2Image html2Image = Html2Image.fromHtml(replace3); Html2Image html2Image = Html2Image.fromHtml(replace3);
logger.debug("#fromHtml耗时:{}ms", System.currentTimeMillis() - s);
String imgPathName = pathName.concat("faceImg"); String imgPathName = pathName.concat("faceImg");
File fatherFile = new File(imgPathName); File fatherFile = new File(imgPathName);
...@@ -238,9 +244,11 @@ public class CodeUtil { ...@@ -238,9 +244,11 @@ public class CodeUtil {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
String imgPath = imgPathName.concat("/").concat(kylinOrderExpress.getMailno()).concat(".png"); String imgPath = imgPathName.concat("/").concat(kylinOrderExpress.getMailno()).concat("-" + num).concat(".png");
logger.debug("#mkdir耗时:{}ms", System.currentTimeMillis() - s);
html2Image.getImageRenderer().saveImage(imgPath); html2Image.getImageRenderer().saveImage(imgPath);
logger.debug("#saveImage耗时:{}ms", System.currentTimeMillis() - s);
return imgPath; return imgPath;
} }
......
...@@ -578,19 +578,22 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres ...@@ -578,19 +578,22 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
int num = 0; int num = 0;
do { do {
for (String orderExpressId : ids) { for (String orderExpressId : ids) {
long s = System.currentTimeMillis();
KylinOrderExpress kylinOrderExpress = kylinOrderExpressMapper.selectOne( KylinOrderExpress kylinOrderExpress = kylinOrderExpressMapper.selectOne(
Wrappers.lambdaQuery(KylinOrderExpress.class) Wrappers.lambdaQuery(KylinOrderExpress.class)
.eq(KylinOrderExpress::getOrderExpressId, orderExpressId) .eq(KylinOrderExpress::getOrderExpressId, orderExpressId)
); );
log.debug("#OrderExpress查询耗时:{}ms", System.currentTimeMillis() - s);
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne( KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
Wrappers.lambdaQuery(KylinOrderTickets.class) Wrappers.lambdaQuery(KylinOrderTickets.class)
.eq(KylinOrderTickets::getOrderTicketsId, kylinOrderExpress.getOrderTicketsId()) .eq(KylinOrderTickets::getOrderTicketsId, kylinOrderExpress.getOrderTicketsId())
); );
String imgPath = codeUtil.html2img(kylinOrderExpress, jContact, jProvince.concat(jCity).concat(jAddress), jTel, orderInfo); log.debug("#orderInfo查询耗时:{}ms", System.currentTimeMillis() - s);
String imgPath = codeUtil.html2img(kylinOrderExpress, jContact, jProvince.concat(jCity).concat(jAddress), jTel, orderInfo, num);
} }
num++; num++;
System.out.println(num); System.out.println(num);
} while (num <= 20000); } while (num <= 1000);
String zpiPath = zipMultiFileUtil.goZip(); String zpiPath = zipMultiFileUtil.goZip();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment