|
@@ -408,7 +408,7 @@ public class OrderServiceImpl implements OrderService {
|
|
head.setTitle(storeEntity.getStoreName());
|
|
head.setTitle(storeEntity.getStoreName());
|
|
// head.setMemberId(orderEntity.getUserName().toString());
|
|
// head.setMemberId(orderEntity.getUserName().toString());
|
|
head.setOrderId(orderEntity.getOrderSn());
|
|
head.setOrderId(orderEntity.getOrderSn());
|
|
- head.setTradeTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EEE").format(new Date()));
|
|
|
|
|
|
+ head.setTradeTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EEE").format(orderEntity.getPayTime()));
|
|
|
|
|
|
// 商品信息
|
|
// 商品信息
|
|
Integer goodsTotal = 0; // 商品总个数
|
|
Integer goodsTotal = 0; // 商品总个数
|
|
@@ -493,6 +493,8 @@ public class OrderServiceImpl implements OrderService {
|
|
if (StringUtils.isNullOrEmpty(exprNo)) {
|
|
if (StringUtils.isNullOrEmpty(exprNo)) {
|
|
throw new RRException("快递面单为空,请联系客服");
|
|
throw new RRException("快递面单为空,请联系客服");
|
|
}
|
|
}
|
|
|
|
+ //图片地址
|
|
|
|
+ mailInfo.setStoreImgUrl(storeEntity.getStoreImgUrl()==null?"/statics/img/cw_qrcode.png":storeEntity.getStoreImgUrl().trim());
|
|
mailInfo.setExprNo(exprNo);
|
|
mailInfo.setExprNo(exprNo);
|
|
String logoUrl = "/statics/img/yto_logo.jpg";
|
|
String logoUrl = "/statics/img/yto_logo.jpg";
|
|
|
|
|
|
@@ -506,7 +508,7 @@ public class OrderServiceImpl implements OrderService {
|
|
mailInfo.setExprLogoUrl(logoUrl);
|
|
mailInfo.setExprLogoUrl(logoUrl);
|
|
byte[] barCode128 = BarcodeUtil.generateBarCode128(exprNo, 6.0D, null, true, false);
|
|
byte[] barCode128 = BarcodeUtil.generateBarCode128(exprNo, 6.0D, null, true, false);
|
|
String exprNoBase64Img = new String(Base64.getEncoder().encode(barCode128));
|
|
String exprNoBase64Img = new String(Base64.getEncoder().encode(barCode128));
|
|
- mailInfo.setShopTel("0752-2688660");
|
|
|
|
|
|
+ mailInfo.setShopTel(storeEntity.getTelephoneNumber()==null?"0752-2688660":storeEntity.getTelephoneNumber().trim());
|
|
|
|
|
|
// 发货人
|
|
// 发货人
|
|
mailInfo.setSenderTel("0752-2688660");
|
|
mailInfo.setSenderTel("0752-2688660");
|
|
@@ -3314,6 +3316,135 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Ticket printMsgEwb(long id, String sessionId) {
|
|
|
|
+ OrderEntity orderEntity = queryInfos(id);
|
|
|
|
+
|
|
|
|
+ List<OrderGoodsEntity> orderGoodsEntityList = orderEntity.getOrderGoodsEntityList();
|
|
|
|
+ // 获取门店
|
|
|
|
+ StoreEntity storeEntity = storeDao.queryObject(orderEntity.getStoreId());
|
|
|
|
+ // 获取清关信息
|
|
|
|
+ OrderProcessRecordEntity orderProcessRecordEntity =
|
|
|
|
+ orderProcessRecordDao.queryObjectByOrderSn(orderEntity.getOrderSn());
|
|
|
|
+
|
|
|
|
+ // 小票头
|
|
|
|
+ TicketHead head = new TicketHead();
|
|
|
|
+ head.setTitle(storeEntity.getStoreName());
|
|
|
|
+ // head.setMemberId(orderEntity.getUserName().toString());
|
|
|
|
+ head.setOrderId(orderEntity.getOrderSn());
|
|
|
|
+ head.setTradeTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EEE").format(orderEntity.getPayTime()));
|
|
|
|
+
|
|
|
|
+ // 商品信息
|
|
|
|
+ Integer goodsTotal = 0; // 商品总个数
|
|
|
|
+ BigDecimal total = Constant.ZERO; // 商品总计
|
|
|
|
+ BigDecimal taxTotal = Constant.ZERO; //税费总计
|
|
|
|
+ List<Goods> goodsList = new ArrayList<>();
|
|
|
|
+ BigDecimal discountedPrice = Constant.ZERO; // 优惠金额
|
|
|
|
+ for (OrderGoodsEntity orderGoods : orderGoodsEntityList) {
|
|
|
|
+ goodsTotal += orderGoods.getNumber();
|
|
|
|
+ total = total.add(orderGoods.getRetailPrice().multiply(new BigDecimal(orderGoods.getNumber())))
|
|
|
|
+ .setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ discountedPrice = discountedPrice.add(orderGoods.getDiscountedPrice());
|
|
|
|
+
|
|
|
|
+ GoodsEntity goodsEntity = goodsService.queryObject(orderGoods.getGoodsId());
|
|
|
|
+ BigDecimal goodsTax = CalculateTax.calculateFinalTax(goodsEntity, orderGoods.getRetailPrice(), goodsService).setScale(3, RoundingMode.HALF_UP);
|
|
|
|
+ goodsTax = goodsTax.multiply(new BigDecimal(orderGoods.getNumber())).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
+ taxTotal = taxTotal.add(goodsTax).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
+
|
|
|
|
+ Goods goods = new Goods(orderGoods.getGoodsName(),
|
|
|
|
+ orderGoods.getRetailPrice().toString(), // 含税价
|
|
|
|
+// beforeTaxPrice.toString(),// 税前价
|
|
|
|
+ goodsTax.toString(),
|
|
|
|
+ orderGoods.getNumber().toString(),
|
|
|
|
+ new BigDecimal(orderGoods.getNumber()).multiply(orderGoods.getRetailPrice()).setScale(2, RoundingMode.HALF_UP).toString(),
|
|
|
|
+ orderGoods.getDiscountedPrice().toString());
|
|
|
|
+ goodsList.add(goods);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 收银信息
|
|
|
|
+ CashInfo cashInfo = new CashInfo();
|
|
|
|
+ cashInfo.setGoodsTotal(goodsTotal.toString());
|
|
|
|
+ cashInfo.setTotal(total.setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ cashInfo.setTaxTotal(taxTotal.setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ cashInfo.setReceipts(orderEntity.getActualPrice().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ cashInfo.setOddChange(discountedPrice.toString());
|
|
|
|
+ cashInfo.setCoupon(orderEntity.getCouponPrice().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ cashInfo.setFreight(
|
|
|
|
+ new BigDecimal(orderEntity.getFreightPrice()).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ if ("alipay".equals(orderEntity.getPayFlag())) {
|
|
|
|
+ cashInfo.setPaymentMode("支付宝支付");
|
|
|
|
+ } else {
|
|
|
|
+ cashInfo.setPaymentMode("微信支付");
|
|
|
|
+ }
|
|
|
|
+ // 海关清单
|
|
|
|
+ CusListing cusListing = new CusListing();
|
|
|
|
+ cusListing.setOrderId(orderEntity.getOrderSn());
|
|
|
|
+ if (!orderEntity.getOrderBizType().equalsIgnoreCase(Dict.orderBizType.item_11.getItem())) {
|
|
|
|
+ cusListing.setWaybillId(orderProcessRecordEntity.getLogisticsNo());
|
|
|
|
+ cusListing.setInvtNo(orderProcessRecordEntity.getInvtNo()==null?"":orderProcessRecordEntity.getInvtNo());
|
|
|
|
+
|
|
|
|
+ cusListing.setConsignee(orderEntity.getConsignee());
|
|
|
|
+ // 脱敏设置
|
|
|
|
+ if (StringUtils.isNotEmpty(cusListing.getConsignee()) && cusListing.getConsignee().length() > 1) {
|
|
|
|
+ cusListing.setConsignee(new StringBuilder(cusListing.getConsignee()).replace(1, 2, "*").toString());
|
|
|
|
+ }
|
|
|
|
+ cusListing.setConsigneeTel(orderEntity.getMobile());
|
|
|
|
+ if (StringUtils.isNotEmpty(cusListing.getConsigneeTel())) {
|
|
|
|
+ cusListing.setConsigneeTel(new StringBuilder(cusListing.getConsigneeTel()).replace(3, 7, "****").toString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ cusListing.setOriginAddress(PrintTicketPropertiesBuilder.instance().getAddress());
|
|
|
|
+ cusListing.setDeliveryAddress(storeEntity.getStoreAddress());
|
|
|
|
+ // 尝试在取货码表中查询数据,如果有的话就改变状态
|
|
|
|
+// String orderSn = orderEntity.getOrderSn();
|
|
|
|
+// PickUpCodeEntity pickUpCodeEntity = pickUpCodeService.queryObject(orderSn);
|
|
|
|
+// if (pickUpCodeEntity != null) {
|
|
|
|
+// pickUpCodeEntity.setPickUpCodeStatus("0");
|
|
|
|
+// pickUpCodeService.update(pickUpCodeEntity);
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+ TicketMailInfo mailInfo = new TicketMailInfo();
|
|
|
|
+ String exprNo = orderProcessRecordEntity.getLogisticsNo();
|
|
|
|
+ if (StringUtils.isNullOrEmpty(exprNo)) {
|
|
|
|
+ throw new RRException("快递面单为空,请联系客服");
|
|
|
|
+ }
|
|
|
|
+ //图片地址
|
|
|
|
+ mailInfo.setStoreImgUrl(storeEntity.getStoreImgUrl()==null?"/statics/img/cw_qrcode.png":storeEntity.getStoreImgUrl().trim());
|
|
|
|
+ mailInfo.setExprNo(exprNo);
|
|
|
|
+ String logoUrl = "/statics/img/yto_logo.jpg";
|
|
|
|
+
|
|
|
|
+ Map<String, String> logoMap = new HashMap<>();
|
|
|
|
+ logoMap.put("yto", "/statics/img/yto_logo.jpg");
|
|
|
|
+ logoMap.put("best", "/statics/img/bestex_logo3.png");
|
|
|
|
+ if (StringUtils.isNotEmpty(orderEntity.getShippingCode()) && logoMap.containsKey(orderEntity.getShippingCode())) {
|
|
|
|
+ logoUrl = logoMap.get(orderEntity.getShippingCode());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mailInfo.setExprLogoUrl(logoUrl);
|
|
|
|
+ byte[] barCode128 = BarcodeUtil.generateBarCode128(exprNo, 6.0D, null, true, false);
|
|
|
|
+ String exprNoBase64Img = new String(Base64.getEncoder().encode(barCode128));
|
|
|
|
+ mailInfo.setShopTel(storeEntity.getTelephoneNumber()==null?"0752-2688660":storeEntity.getTelephoneNumber().trim());
|
|
|
|
+
|
|
|
|
+ // 发货人
|
|
|
|
+ mailInfo.setSenderTel("0752-26886602");
|
|
|
|
+ mailInfo.setSenderName("CW澳洲大药房");
|
|
|
|
+ mailInfo.setSenderProvince("广东省");
|
|
|
|
+ mailInfo.setSenderCity("深圳市");
|
|
|
|
+ mailInfo.setSenderDistrict("南山区");
|
|
|
|
+ mailInfo.setSenderAddress("前海综合保税区W104");
|
|
|
|
+
|
|
|
|
+ // 收货人
|
|
|
|
+ mailInfo.setConsigneeMob(new StringBuilder(orderEntity.getMobile()).replace(3, 7, "****").toString());
|
|
|
|
+ mailInfo.setConsigneeName(new StringBuilder(orderEntity.getConsignee()).replace(1, 2, "*").toString());
|
|
|
|
+ mailInfo.setConsigneeProvince(orderEntity.getProvince());
|
|
|
|
+ mailInfo.setConsigneeCity(orderEntity.getCity());
|
|
|
|
+ mailInfo.setConsigneeDistrict(orderEntity.getDistrict());
|
|
|
|
+ mailInfo.setConsigneeAddress(orderEntity.getAddress());
|
|
|
|
+
|
|
|
|
+ mailInfo.setExprNoBase64Img(exprNoBase64Img);
|
|
|
|
+ return TicketPrintUtil.print(head, goodsList, cashInfo, cusListing, mailInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 设置订单数据
|
|
* 设置订单数据
|