订单预计收入增加了 打包费, 打印模版修改
This commit is contained in:
parent
eee78433e4
commit
e4f623420d
@ -55,11 +55,12 @@ public interface ShopOrderBaseMapper extends BaseMapper<ShopOrderBase> {
|
||||
/**
|
||||
* 获取已付款订单的打印信息(用于渲染打票机模版)
|
||||
*
|
||||
* @param storeId
|
||||
* @param orderId
|
||||
* @param payState
|
||||
* @return
|
||||
*/
|
||||
Map getOrderPrintInfo(@Param("orderId") String orderId, Integer payState);
|
||||
Map getOrderPrintInfo(@Param("storeId") Integer storeId, @Param("orderId") String orderId, @Param("payState") Integer payState);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -12,7 +12,6 @@ import com.suisung.mall.common.pojo.req.SFCreateOrderReq;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
import com.suisung.mall.shop.order.vo.OrdeListVo;
|
||||
import com.suisung.mall.shop.product.pojo.vo.FixOrderVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
@ -518,11 +517,12 @@ public interface ShopOrderBaseService extends IBaseService<ShopOrderBase> {
|
||||
/**
|
||||
* 获取已付款订单的打印信息(用于渲染打票机模版)
|
||||
*
|
||||
* @param storeId
|
||||
* @param orderId
|
||||
* @param payState 支付状态,参考StateCode.ORDER_PAID_STATE_YES
|
||||
* @return
|
||||
*/
|
||||
Map getOrderPrintInfo(@Param("orderId") String orderId, @Param("payState") Integer payState);
|
||||
Map getOrderPrintInfo(Integer storeId, String orderId, Integer payState);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -106,7 +106,6 @@ import io.seata.tm.api.GlobalTransaction;
|
||||
import io.seata.tm.api.GlobalTransactionContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -8442,12 +8441,13 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getOrderPrintInfo(@Param("orderId") String orderId, Integer payState) {
|
||||
public Map getOrderPrintInfo(Integer storeId, String orderId, Integer payState) {
|
||||
if (StrUtil.isBlank(orderId)) {
|
||||
logger.error("缺少必要参数:orderId:{}");
|
||||
return null;
|
||||
}
|
||||
|
||||
Map m = shopOrderBaseMapper.getOrderPrintInfo(orderId, payState);
|
||||
Map m = shopOrderBaseMapper.getOrderPrintInfo(storeId, orderId, payState);
|
||||
if (m == null) {
|
||||
return null;
|
||||
}
|
||||
@ -8486,7 +8486,8 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
m.put("delivery_type_name", deliveryTypeName);
|
||||
|
||||
// 预留字段
|
||||
m.put("quanyi", m.getOrDefault("total_discount_amount", 0.00)); // 会员权益
|
||||
m.put("quanyi", m.getOrDefault("order_discount_amount", 0.00)); // 会员权益
|
||||
m.put("packing_fee", m.getOrDefault("packing_fee", 0.00)); // 打包费
|
||||
m.put("miaosha", 0.00); // 秒杀
|
||||
m.put("yajin", 0.00); // 押金
|
||||
m.put("cashier", m.getOrDefault("store_name", "店长")); // 收银员
|
||||
|
||||
@ -333,7 +333,7 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
}
|
||||
|
||||
// 订单状态处理成功之后,打印小票
|
||||
shopStorePrinterService.printShopStoreOrder(orderId);
|
||||
shopStorePrinterService.printShopStoreOrder(storeId, orderId);
|
||||
logger.info("####新生成订单{}的取单号####", orderPickupNum);
|
||||
return orderPickupNum;
|
||||
}
|
||||
|
||||
@ -47,8 +47,8 @@ public class ShopStorePrinterController {
|
||||
|
||||
@ApiOperation(value = "测试打印模版消息", notes = "测试打印模版消息")
|
||||
@RequestMapping(value = "/print/order", method = {RequestMethod.POST})
|
||||
public boolean printOrder(@RequestParam(name = "orderId", required = true) String orderId) {
|
||||
return shopStorePrinterService.printShopStoreOrder(orderId);
|
||||
public boolean printOrder(@RequestParam(name = "storeId", required = false) Integer storeId, @RequestParam(name = "orderId", required = true) String orderId) {
|
||||
return shopStorePrinterService.printShopStoreOrder(storeId, orderId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "门店打票机分页列表查询", notes = "门店打票机分页列表查询")
|
||||
|
||||
@ -74,10 +74,11 @@ public interface ShopStorePrinterService extends IBaseService<ShopStorePrinter>
|
||||
/**
|
||||
* 支付成功后,立即打印门店的订单信息
|
||||
*
|
||||
* @param storeId
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
Boolean printShopStoreOrder(String orderId);
|
||||
Boolean printShopStoreOrder(Integer storeId, String orderId);
|
||||
|
||||
/**
|
||||
* 获取店铺所有有效打印机
|
||||
|
||||
@ -306,9 +306,9 @@ public class ShopStorePrinterServiceImpl extends BaseServiceImpl<ShopStorePrinte
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean printShopStoreOrder(String orderId) {
|
||||
public Boolean printShopStoreOrder(Integer storeId, String orderId) {
|
||||
logger.debug("#### 调用飞鹅打票机的打印操作开始 ####");
|
||||
logger.debug("#### 打印订单:{} ####", orderId);
|
||||
logger.debug("#### 店铺:{},打印订单:{} ####", storeId, orderId);
|
||||
// 获取订单,包含所有所需的字段,参考实体类:ShopStoreOrderPrintVO 和 ShopStoreOrderProductPrintVO
|
||||
|
||||
if (StrUtil.isBlank(orderId)) {
|
||||
@ -317,13 +317,16 @@ public class ShopStorePrinterServiceImpl extends BaseServiceImpl<ShopStorePrinte
|
||||
}
|
||||
|
||||
// 获取打印的订单信息,判断订单支付状态:已支付
|
||||
Map<String, Object> binding = shopOrderBaseService.getOrderPrintInfo(orderId, StateCode.ORDER_PAID_STATE_YES);
|
||||
Map<String, Object> binding = shopOrderBaseService.getOrderPrintInfo(storeId, orderId, StateCode.ORDER_PAID_STATE_YES);
|
||||
if (binding == null) {
|
||||
logger.error("订单{}信息无法获取,无法打印小票。", orderId);
|
||||
return false;
|
||||
}
|
||||
|
||||
Integer storeId = Convert.toInt(binding.get("store_id")); // NumberUtil.parseInt(binding.get("store_id").toString());
|
||||
if (CheckUtil.isEmpty(storeId) && binding.get("store_id") != null) {
|
||||
storeId = Convert.toInt(binding.get("store_id"));
|
||||
}
|
||||
|
||||
// 从订单里,获取店铺 Id,再找出打印机,下单订单打印模版(如果没使用公共的下单订单模版)
|
||||
List<ShopStorePrinter> printerList = selectPrinterList(storeId);
|
||||
if (CollUtil.isEmpty(printerList)) {
|
||||
|
||||
@ -537,6 +537,7 @@
|
||||
b.order_title, b.delivery_type_id, b.payment_type_id, b.payment_time, b.order_pickup_num,
|
||||
c.order_message, c.order_item_amount, c.order_shipping_fee, c.order_shipping_fee_amount, c.delivery_time,
|
||||
(c.order_discount_amount + c.voucher_price + c.order_points_fee + c.order_adjust_fee) as total_discount_amount,
|
||||
c.packing_fee,
|
||||
e.store_tel,
|
||||
f.da_province,f.da_city,f.da_address,f.da_mobile, f.order_id,
|
||||
g.payment_channel_id, h.payment_channel_name
|
||||
@ -549,11 +550,15 @@
|
||||
left join pay_consume_trade g on a.order_id=g.order_id
|
||||
left join pay_payment_channel h on g.payment_channel_id=h.payment_channel_id
|
||||
<where>
|
||||
<if test="orderId!=null ">
|
||||
<if test="storeId!=null and storeId > 0">
|
||||
and a.store_id=#{storeId}
|
||||
</if>
|
||||
|
||||
<if test="orderId!=null and orderId != ''">
|
||||
and a.order_id=#{orderId}
|
||||
</if>
|
||||
|
||||
<if test="payState!=null ">
|
||||
<if test="payState!=null">
|
||||
and b.order_is_paid=#{payState}
|
||||
</if>
|
||||
</where>
|
||||
@ -778,8 +783,8 @@
|
||||
<!--总计优惠金额 order_discount_amount + order_voucher_price + order_points_fee + order_adjust_fee-->
|
||||
(od.order_discount_amount + od.voucher_price + od.order_points_fee + od.order_adjust_fee) as
|
||||
total_discount_amount,
|
||||
<!--预计收入:订单原价金额-总计优惠金额-配送费-平台费-->
|
||||
(ob.order_product_amount-od.order_discount_amount-od.voucher_price-od.order_points_fee-od.order_adjust_fee-od.platform_fee-od.order_shipping_fee)
|
||||
<!--预计收入:订单原价金额-总计优惠金额-配送费-平台费 + 打包费-->
|
||||
(ob.order_product_amount-od.order_discount_amount-od.voucher_price-od.order_points_fee-od.order_adjust_fee-od.platform_fee-od.order_shipping_fee+od.packing_fee)
|
||||
as order_income_amount,
|
||||
od.platform_fee,
|
||||
od.packing_fee,
|
||||
|
||||
@ -34,7 +34,8 @@
|
||||
商品总额:<BOLD>¥18.7</BOLD><BR>
|
||||
押金:<BOLD>¥500</BOLD><BR>
|
||||
运费:<BOLD>¥5.54</BOLD><BR>
|
||||
会员权益:<BOLD>-¥50</BOLD><BR>
|
||||
打包费:<BOLD>¥0.54</BOLD><BR>
|
||||
优惠金额:<BOLD>-¥50</BOLD><BR>
|
||||
秒杀:<BOLD>-¥100</BOLD><BR>
|
||||
实付金额:<BOLD>¥428.9元</BOLD><BR>
|
||||
--------------------------------<BR>
|
||||
@ -56,4 +57,4 @@
|
||||
<CB>${store_name}</CB><BR>--------------------------------<BR><CB>#${order_pickup_num_str}</CB><BR><L>买家备注:${order_message!'-'}</L><BR><BOLD>配送时间:${payment_time?string('MM-dd HH:mm')}~${delivery_time?string('HH:mm')}</BOLD><BR>--------------------------------<BR>订单编号:${order_id}<BR>订单来源:微信小程序<BR>支付方式:微信支付<BR>配送来源:顺丰同城<BR>付款时间:${payment_time?string('yyyy-MM-dd HH:mm:ss')}<BR>--------------------------------<BR><L>商品名称 数量 金额</L><BR>--------------------------------<BR><#list order_items as item><L>${item.s_name}</L><L><BOLD>${item.s_quantity}</BOLD></L><L>${item.s_amount}</L><BR><#if item.s_name_segs??><#list item.s_name_segs as seg><L>${seg}</L><BR></#list></#if><BOLD><#if item.product_sn?default("")?trim?length gt 1>${item.product_sn}</BOLD><BR></#if></#list>--------------------------------<BR>商品总件数:<BOLD>${order_items_count!0}</BOLD><BR>商品总额:<BOLD>¥${order_product_amount?string('0.00')}</BOLD><BR>押金:<BOLD>¥${(yajin!0)?string('0.00')}</BOLD><BR>运费:<BOLD>¥${order_shipping_fee?string('0.00')}</BOLD><BR>会员权益:<BOLD>-¥${(quanyi!0)?string('0.00')}</BOLD><BR>秒杀:<BOLD>-¥${(miaosha!0)?string('0.00')}</BOLD><BR>实付金额:<BOLD>¥${order_payment_amount?string('0.00')}</BOLD><BR><#if seller_message?default("")?trim?length gt 1>--------------------------------<BR><BOLD>商家备注:${seller_message!'-'}</BOLD><BR></#if>--------------------------------<BR><BOLD>收货人:${buyer_user_name!''}</BOLD><BR><BOLD>收货人手机:${da_mobile!'-'}</BOLD><BR><BOLD>收货地址:${da_province!'-'}${da_city!'-'}${da_address!'-'}</BOLD><BR>--------------------------------<BR>门店:${store_name}<BR>门店电话:<BOLD>${store_tel!'-'}</BOLD><BR>收银员:${cashier!'店长'}<BR>
|
||||
|
||||
第二版带变量的模版:
|
||||
<CB>${store_name}</CB><BR>--------------------------------<BR><CB>#${order_pickup_num_str}</CB><BR><L>买家备注:${order_message!'-'}</L><BR><BOLD>配送时间:${payment_time?string('MM-dd HH:mm')}~${delivery_time?string('HH:mm')}</BOLD><BR>--------------------------------<BR>订单编号:${order_id}<BR>订单来源:微信小程序<BR>支付方式:微信支付<BR>配送来源:顺丰同城<BR>付款时间:${payment_time?string('yyyy-MM-dd HH:mm:ss')}<BR>--------------------------------<BR><L>商品名称 数量 金额</L><BR>--------------------------------<BR><#list order_items as item><L>${item.s_name}</L><L><BOLD>${item.s_quantity}</BOLD></L><L>${item.s_amount}</L><BR><#if item.s_name_segs??><#list item.s_name_segs as seg><L>${seg}</L><BR></#list></#if><BOLD><#if item.product_sn?default("")?trim?length gt 1>${item.product_sn}</BOLD><BR></#if></#list>--------------------------------<BR>商品总件数:<BOLD>${order_items_count!0}</BOLD><BR>商品总额:<BOLD>¥${order_product_amount?string('0.00')}</BOLD><BR>运费:<BOLD>¥${order_shipping_fee?string('0.00')}</BOLD><BR>优惠金额:<BOLD>-¥${(quanyi!0)?string('0.00')}</BOLD><BR>实付金额:<BOLD>¥${order_payment_amount?string('0.00')}</BOLD><BR><#if seller_message?default("")?trim?length gt 1>--------------------------------<BR><BOLD>商家备注:${seller_message!'-'}</BOLD><BR></#if>--------------------------------<BR><BOLD>收货人:${buyer_user_name!''}</BOLD><BR><BOLD>收货人手机:${da_mobile!'-'}</BOLD><BR><BOLD>收货地址:${da_province!'-'}${da_city!'-'}${da_address!'-'}</BOLD><BR>--------------------------------<BR>门店:${store_name}<BR>门店电话:<BOLD>${store_tel!'-'}</BOLD><BR>收银员:${cashier!'店长'}<BR>
|
||||
<CB>${store_name}</CB><BR>--------------------------------<BR><CB>#${order_pickup_num_str}</CB><BR><L>买家备注:${order_message!'-'}</L><BR><BOLD>配送时间:${payment_time?string('MM-dd HH:mm')}~${delivery_time?string('HH:mm')}</BOLD><BR>--------------------------------<BR>订单编号:${order_id}<BR>订单来源:微信小程序<BR>支付方式:微信支付<BR>配送来源:顺丰同城<BR>付款时间:${payment_time?string('yyyy-MM-dd HH:mm:ss')}<BR>--------------------------------<BR><L>商品名称 数量 金额</L><BR>--------------------------------<BR><#list order_items as item><L>${item.s_name}</L><L><BOLD>${item.s_quantity}</BOLD></L><L>${item.s_amount}</L><BR><#if item.s_name_segs??><#list item.s_name_segs as seg><L>${seg}</L><BR></#list></#if><BOLD><#if item.product_sn?default("")?trim?length gt 1>${item.product_sn}</BOLD><BR></#if></#list>--------------------------------<BR>商品总件数:<BOLD>${order_items_count!0}</BOLD><BR>商品总额:<BOLD>¥${order_product_amount?string('0.00')}</BOLD><BR>运费:<BOLD>¥${order_shipping_fee?string('0.00')}</BOLD><BR><#if packing_fee?? && (packing_fee > 0)>打包费:<BOLD>¥${packing_fee?string('0.00')}</BOLD><BR></#if>优惠金额:<BOLD>-¥${(quanyi!0)?string('0.00')}</BOLD><BR>实付金额:<BOLD>¥${order_payment_amount?string('0.00')}</BOLD><BR><#if seller_message?default("")?trim?length gt 1>--------------------------------<BR><BOLD>商家备注:${seller_message!'-'}</BOLD><BR></#if>--------------------------------<BR><BOLD>收货人:${buyer_user_name!''}</BOLD><BR><BOLD>收货人手机:${da_mobile!'-'}</BOLD><BR><BOLD>收货地址:${da_province!'-'}${da_city!'-'}${da_address!'-'}</BOLD><BR>--------------------------------<BR>门店:${store_name}<BR>门店电话:<BOLD>${store_tel!'-'}</BOLD><BR>收银员:${cashier!'店长'}<BR>
|
||||
Loading…
Reference in New Issue
Block a user