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

Commit efa1d41c authored by jiangxiulong's avatar jiangxiulong

pring test

parent 838718dd
......@@ -228,6 +228,25 @@ public class PerformancesExpressController extends BaseController {
}
}
/**
* 批量下单
*/
@RequiresPermissions("kylin:performancesExpress:batchPrint")
@PostMapping("/batchPrint")
@ResponseBody
public ResponseDto batchPrint(@RequestParam("ids") String performanceId) {
String res = performancesExpressServiceImpl.batchPrint(performanceId);
try {
if (res.isEmpty()) {
return ResponseDto.failure("处理失败");
} else {
return ResponseDto.success(res);
}
} catch (Exception e) {
return ResponseDto.failure(e.getMessage());
}
}
/**
* 打印快递单
*/
......
......@@ -81,17 +81,18 @@
var orderStatusDic = [[${@dict.getType('zhengzai_order_status')}]];
function printAjax(orderExpressId) {
var configPrint = {
var configPrint = {
url: prefix + "/print",
type: "post",
dataType: "json",
data: {ids:orderExpressId},
data: {ids: orderExpressId},
beforeSend: function () {
$.modal.loading("正在处理中,请稍后...");
},
success: function (result) {
$.modal.closeLoading();
console.log(result);
var url = "https://img.zhengzai.tv/" + result.data;
window.location.href = url;
}
};
$.ajax(configPrint)
......@@ -129,22 +130,22 @@
{
field: '',
title: '购买用户',
formatter: function(value, row, index) {
formatter: function (value, row, index) {
// var userId = row.userId;
var userMobile = row.userMobile;
var userName = row.userName;
// return 'ID:'+userId+'<br>'+'姓名:'+userName+'<br>'+'手机号:'+userMobile;
return '昵称:'+userName+'<br>'+'手机号:'+userMobile;
return '昵称:' + userName + '<br>' + '手机号:' + userMobile;
}
},
{
field: '',
title: '收货用户',
formatter: function(value, row, index) {
formatter: function (value, row, index) {
var expressContacts = row.expressContacts;
var expressAddress = row.expressAddress;
var expressPhone = row.expressPhone;
return '姓名:'+expressContacts+'<br>'+'手机号:'+expressPhone+'<br>'+'地址:'+expressAddress;
return '姓名:' + expressContacts + '<br>' + '手机号:' + expressPhone + '<br>' + '地址:' + expressAddress;
}
},
{
......@@ -168,7 +169,7 @@
{
field: '',
title: '快递信息',
formatter: function(value, row, index) {
formatter: function (value, row, index) {
var mailno = row.mailno;
var expressStatus = row.expressStatus;
var expressStatusName = '';
......@@ -197,7 +198,7 @@
break;
}
}
return '快递单号:'+mailno+'<br>'+'快递状态:'+expressStatusName;
return '快递单号:' + mailno + '<br>' + '快递状态:' + expressStatusName;
}
},
{
......@@ -208,7 +209,7 @@
actions.push('<a class="btn btn-success btn-xs ' + placeOrderFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定下单吗?\', table.options.placeOrderUrl)"></i>下单</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + cancelOrderFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定取消快递单吗?\', table.options.cancelOrderUrl)"></i>取消</a> ');
// actions.push('<a class="btn btn-warning btn-xs ' + printFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderExpressId + '\', \'确定批量打印吗?\', table.options.printUrl)"></i>打印</a> ');
actions.push('<a class="btn btn-warning btn-xs ' + printFlag + '" href="javascript:void(0)" onclick="printAjax(\'' + row.orderExpressId + '\',)"></i>打印</a> ');
actions.push('<a class="btn btn-warning btn-xs ' + printFlag + '" href="javascript:void(0)" onclick="printAjax(\'' + row.orderExpressId + '\',)"></i>下载快递单</a> ');
// actions.push('<a class="btn btn-success btn-xs ' + getResultFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定获取快递信息吗?\', table.options.getResultUrl)"></i>主动获取下单信息</a> ');
// actions.push('<a class="btn btn-success btn-xs ' + getFreightFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定获取估算运费吗?\', table.options.getFreightUrl)"></i>运费估算</a> ');
// actions.push('<a class="btn btn-success btn-xs ' + getListFreightFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定获取运费信息吗?\', table.options.getListFreightUrl)"></i>主动获取运费</a> ');
......
......@@ -39,8 +39,31 @@
var performanceOrderListFlag = [[${@permission.hasPermi('kylin:performancesExpress:performanceOrderList')}]];
var batchPlaceOrderFlag = [[${@permission.hasPermi('kylin:performancesExpress:batchPlaceOrder')}]];
var batchCancelOrderFlag = [[${@permission.hasPermi('kylin:performancesExpress:batchCancelOrder')}]];
var printFlag = [[${@permission.hasPermi('kylin:performancesExpress:print')}]];
var prefix = ctx + "kylin/performancesExpress";
var batchPrintFlag = [[${@permission.hasPermi('kylin:performancesExpress:batchPrint')}]];
function printAjax(performanceId) {
var configPrint = {
url: prefix + "/batchPrint",
type: "post",
dataType: "json",
data: {ids: performanceId},
beforeSend: function () {
$.modal.loading("正在处理中,请稍后...");
},
success: function (result) {
$.modal.closeLoading();
if (result.data != '' && result.data != null) {
var url = "https://img.zhengzai.tv/" + result.data;
window.location.href = url;
} else {
$.modal.msg("暂无需打印单");
}
}
};
$.ajax(configPrint)
}
$(function () {
var options = {
......@@ -87,7 +110,7 @@
actions.push('<a class="btn btn-success btn-xs ' + performanceOrderListFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.performancesId + '\')"><i class="fa fa-edit"></i>查看</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + batchPlaceOrderFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.performancesId + '\', \'确定批量下单吗?\', table.options.batchPlaceOrderUrl)"></i>下单</a> ');
actions.push('<a class="btn btn-warning btn-xs ' + batchCancelOrderFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.performancesId + '\', \'确定批量取消吗?\', table.options.batchCancelOrderUrl)"></i>取消</a> ');
actions.push('<a class="btn btn-warning btn-xs ' + printFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.performancesId + '\', \'确定批量打印吗?\', table.options.printUrl)"></i>打印</a> ');
actions.push('<a class="btn btn-warning btn-xs ' + batchPrintFlag + '" href="javascript:void(0)" onclick="printAjax(\'' + row.performancesId + '\',)"></i>下载快递单</a> ');
return actions.join('');
}
}]
......
......@@ -281,18 +281,18 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
KylinOrderExpressPerformances expressPerformances = kylinOrderExpressPerformancesMapper.selectOne(new QueryWrapper<KylinOrderExpressPerformances>().eq("performances_id", relationsInfo.getPerformanceId()));
KylinOrderExpressPerformances kylinOrderExpressPerformances = new KylinOrderExpressPerformances();
if (null == expressPerformances) {
String orderExpressPerformancesId = IDGenerator.nextSnowId();
kylinOrderExpressPerformances.setOrderExpressPerformancesId(orderExpressPerformancesId);
kylinOrderExpressPerformances.setPerformancesId(relationsInfo.getPerformanceId());
kylinOrderExpressPerformances.setTotal1(1);
String orderExpressPerformancesId = IDGenerator.nextSnowId();
kylinOrderExpressPerformances.setOrderExpressPerformancesId(orderExpressPerformancesId);
kylinOrderExpressPerformances.setPerformancesId(relationsInfo.getPerformanceId());
kylinOrderExpressPerformances.setTotal1(1);
kylinOrderExpressPerformances.setCreatedAt(DateUtil.getNowTime());
kylinOrderExpressPerformancesMapper.insert(kylinOrderExpressPerformances);
} else {
} else {
kylinOrderExpressPerformances.setTotal1(expressPerformances.getTotal1() + 1);
kylinOrderExpressPerformances.setUpdatedAt(DateUtil.getNowTime());
kylinOrderExpressPerformancesMapper.update(kylinOrderExpressPerformances,
new QueryWrapper<KylinOrderExpressPerformances>().eq("performances_id", relationsInfo.getPerformanceId()));
}
}
}
}
return ResponseDto.success();
......@@ -575,25 +575,22 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
public String print(PerformanceExpressSearchAdminParam performanceExpressSearchAdminParam) {
List<String> ids = performanceExpressSearchAdminParam.getIds();
int num = 0;
do {
for (String orderExpressId : ids) {
long s = System.currentTimeMillis();
KylinOrderExpress kylinOrderExpress = kylinOrderExpressMapper.selectOne(
Wrappers.lambdaQuery(KylinOrderExpress.class)
.eq(KylinOrderExpress::getOrderExpressId, orderExpressId)
);
log.debug("#OrderExpress查询耗时:{}ms", System.currentTimeMillis() - s);
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
Wrappers.lambdaQuery(KylinOrderTickets.class)
.eq(KylinOrderTickets::getOrderTicketsId, kylinOrderExpress.getOrderTicketsId())
);
log.debug("#orderInfo查询耗时:{}ms", System.currentTimeMillis() - s);
String imgPath = codeUtil.html2img(kylinOrderExpress, jContact, jProvince.concat(jCity).concat(jAddress), jTel, orderInfo, num);
}
num++;
System.out.println(num);
} while (num <= 1000);
for (String orderExpressId : ids) {
long s = System.currentTimeMillis();
KylinOrderExpress kylinOrderExpress = kylinOrderExpressMapper.selectOne(
Wrappers.lambdaQuery(KylinOrderExpress.class)
.eq(KylinOrderExpress::getOrderExpressId, orderExpressId)
);
// System.out.println(System.currentTimeMillis() - s);
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
Wrappers.lambdaQuery(KylinOrderTickets.class)
.eq(KylinOrderTickets::getOrderTicketsId, kylinOrderExpress.getOrderTicketsId())
);
// System.out.println(System.currentTimeMillis() - s);
String imgPath = codeUtil.html2img(kylinOrderExpress, jContact, jProvince.concat(jCity).concat(jAddress), jTel, orderInfo);
// System.out.println(System.currentTimeMillis() - s);
}
String zpiPath = zipMultiFileUtil.goZip();
......@@ -603,4 +600,16 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
return upload.getOssPath();
}
public String batchPrint(String performanceId) {
List<KylinOrderTickets> orderList = kylinOrderTicketsMapper.getCanCancelOrderList(performanceId, 0, 9999999);
String ossPath = "";
if (!CollectionUtil.isEmpty(orderList)) {
List<String> orderIds = orderList.stream().map(KylinOrderTickets -> KylinOrderTickets.getOrderTicketsId()).collect(Collectors.toList());
PerformanceExpressSearchAdminParam performanceExpressSearchAdminParam = new PerformanceExpressSearchAdminParam();
performanceExpressSearchAdminParam.setIds(orderIds);
ossPath = print(performanceExpressSearchAdminParam);
}
return ossPath;
}
}
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