|
|
|
@ -3200,7 +3200,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
return handleShiPeiData(template, idArray,html); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (1 == type) { |
|
|
|
|
return handleShangPeiData(template.getId(), idArray,html); |
|
|
|
|
} else { |
|
|
|
@ -3215,6 +3214,52 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
handleShangPeiData(1111L, split,"111"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 批量打印预约单 |
|
|
|
|
* @param ids |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<PrintPreviewVO> printBatchByReservation(String ids) { |
|
|
|
|
List<PrintPreviewVO> list = new ArrayList<>(); |
|
|
|
|
BasicPrintTemplateEntity template = getPrintTemplate(2); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); |
|
|
|
|
|
|
|
|
|
String[] idArray = ids.split(","); |
|
|
|
|
if (ObjectUtils.isNull(idArray)) { |
|
|
|
|
throw new ServiceException("参数错误"); |
|
|
|
|
} |
|
|
|
|
for (String s : idArray) { |
|
|
|
|
|
|
|
|
|
DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(Long.valueOf(s)); |
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> printBatchByReservation:distributionReservationEntity {}",distributionReservationEntity); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
buildMapData(map, distributionReservationEntity); |
|
|
|
|
map.put("承运商", ""); |
|
|
|
|
map.put("配送仓库",""); |
|
|
|
|
// TODO 查询配送单的时间
|
|
|
|
|
map.put("出库时间", ""); |
|
|
|
|
|
|
|
|
|
map.put("送货司机", ""); |
|
|
|
|
map.put("车牌号", ""); |
|
|
|
|
|
|
|
|
|
String popHtml = TemplateUtil.popTemplate("预约单", map, html); |
|
|
|
|
PrintPreviewVO printPreviewVO = new PrintPreviewVO(); |
|
|
|
|
printPreviewVO.setTemplateId(template.getId()); |
|
|
|
|
printPreviewVO.setTemplateHtml(popHtml); |
|
|
|
|
list.add(printPreviewVO); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Map<String, String> getDriverCar(String kind, Long deliveryListEntityId) { |
|
|
|
|
Map<String, String> map = new HashMap<>(); |
|
|
|
|
String dirverName = null; |
|
|
|
@ -3387,7 +3432,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
private List<PrintPreviewVO> handleShiPeiData(BasicPrintTemplateEntity template, String[] idArray,String html) throws Exception { |
|
|
|
|
|
|
|
|
|
List<PrintPreviewVO> result = new ArrayList<>(); |
|
|
|
|
List<Map> data = new ArrayList<>(); |
|
|
|
|
for (String id : idArray) { |
|
|
|
|
|
|
|
|
|
// 获取需要的数据
|
|
|
|
@ -3407,38 +3451,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
for (DistributionReservationEntity distributionReservationEntity : distributionReservationEntityList) { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
log.debug(">>>> distributionReservationEntity {}",distributionReservationEntity); |
|
|
|
|
map.put("配送单号", distributionReservationEntity.getReservationCode()); |
|
|
|
|
String fileTypeName = QRCodeUtil.createCodeToFile(distributionReservationEntity.getReservationCode()); |
|
|
|
|
map.put("配送单二维码",QRCodeUtil.getEmpAutograph(fileTypeName)); |
|
|
|
|
|
|
|
|
|
// todo 查询运单的收货人电话
|
|
|
|
|
map.put("商场名称", distributionReservationEntity.getMallName()); |
|
|
|
|
map.put("商场电话", distributionReservationEntity.getReservationCode()); |
|
|
|
|
|
|
|
|
|
map.put("送货日期", DateUtil.format(distributionReservationEntity.getReservationDate(), "yyyy-MM-dd") + " 全天"); |
|
|
|
|
|
|
|
|
|
map.put("客户名称", distributionReservationEntity.getConsignee()); |
|
|
|
|
|
|
|
|
|
map.put("客户电话", distributionReservationEntity.getDeliveryPhone()); |
|
|
|
|
|
|
|
|
|
map.put("送货地址", distributionReservationEntity.getDeliveryAddress()); |
|
|
|
|
|
|
|
|
|
// 通过预约单查询预约下面的订单 --1 或者 库存品 --2
|
|
|
|
|
List<Map<String, Object>> spaclOrderList = buildSpaclOrders(distributionReservationEntity, 1); |
|
|
|
|
|
|
|
|
|
map.put("定制品集合", spaclOrderList); |
|
|
|
|
map.put("定制品合计", spaclOrderList.stream().mapToInt(map1 -> Integer.parseInt(map1.get("数量").toString())).sum()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("备注", distributionReservationEntity.getRemarks()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buildMapData(map, distributionReservationEntity); |
|
|
|
|
map.put("承运商", byId.getDistributionCompany()); |
|
|
|
|
map.put("配送仓库", byId.getWarehouseName()); |
|
|
|
|
// TODO 查询配送单的时间
|
|
|
|
|
map.put("出库时间", byId.getTaskTime()); |
|
|
|
|
|
|
|
|
|
data.add(map); |
|
|
|
|
Map<String, String> driverCar = getDriverCar(byId.getKind(), byId.getId()); |
|
|
|
|
String dirverName = driverCar.get("dirverName"); |
|
|
|
|
String dirverPhone = driverCar.get("dirverPhone"); |
|
|
|
@ -3459,6 +3477,37 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构建预约数据 |
|
|
|
|
* @param map |
|
|
|
|
* @param distributionReservationEntity |
|
|
|
|
*/ |
|
|
|
|
private void buildMapData(Map<String, Object> map,DistributionReservationEntity distributionReservationEntity ){ |
|
|
|
|
map.put("配送单号", distributionReservationEntity.getReservationCode()); |
|
|
|
|
String fileTypeName = QRCodeUtil.createCodeToFile(distributionReservationEntity.getReservationCode()); |
|
|
|
|
map.put("配送单二维码",QRCodeUtil.getEmpAutograph(fileTypeName)); |
|
|
|
|
|
|
|
|
|
// todo 查询运单的收货人电话
|
|
|
|
|
map.put("商场名称", distributionReservationEntity.getMallName()); |
|
|
|
|
map.put("商场电话", distributionReservationEntity.getReservationCode()); |
|
|
|
|
|
|
|
|
|
map.put("送货日期", DateUtil.format(distributionReservationEntity.getReservationDate(), "yyyy-MM-dd") + " 全天"); |
|
|
|
|
|
|
|
|
|
map.put("客户名称", distributionReservationEntity.getConsignee()); |
|
|
|
|
|
|
|
|
|
map.put("客户电话", distributionReservationEntity.getDeliveryPhone()); |
|
|
|
|
|
|
|
|
|
map.put("送货地址", distributionReservationEntity.getDeliveryAddress()); |
|
|
|
|
|
|
|
|
|
// 通过预约单查询预约下面的订单 --1 或者 库存品 --2
|
|
|
|
|
List<Map<String, Object>> spaclOrderList = buildSpaclOrders(distributionReservationEntity, 1); |
|
|
|
|
|
|
|
|
|
map.put("定制品集合", spaclOrderList); |
|
|
|
|
map.put("定制品合计", spaclOrderList.stream().mapToInt(map1 -> Integer.parseInt(map1.get("数量").toString())).sum()); |
|
|
|
|
|
|
|
|
|
map.put("备注", distributionReservationEntity.getRemarks()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private BasicPrintTemplateEntity getPrintTemplate(Integer type) { |
|
|
|
|
BasicPrintTemplateEntity template = null; |
|
|
|
|
if (2 == type) { |
|
|
|
|