油站财务报表,交易

This commit is contained in:
sw 2024-11-07 09:21:08 +08:00
parent e13687be01
commit 829d0a9f15
18 changed files with 916 additions and 264 deletions

View File

@ -44,3 +44,10 @@ export function printLocallyApi(data) {
data: data
})
}
export function handoverShiftPrintingReceipts(data) {
return request({
url: '/business/handoverRecord/handoverShiftPrintingReceipts',
method: 'post',
data: data
})
}

View File

@ -40,7 +40,7 @@
<div class="title_" style="height: 50px; padding-top: 20px; background-color: white; display: flex;justify-content: space-between">
<div style="width: 5%;"></div>
<div style="width: 80%;">门店交接单</div>
<span style="cursor: pointer; color: blue;font-weight: 400;" >打印</span>
<span style="cursor: pointer; color: blue;font-weight: 400;" @click="handoverShiftPrintingReceipt">打印</span>
</div>
<div class="d-s-b">
<div>油站名称</div>
@ -352,7 +352,8 @@ import {
getHandoverApi,
getHandoverApi2,
getHandoverListApi,
printLocallyApi
printLocallyApi,
handoverShiftPrintingReceipts
} from "@/api/handover/handover";
import {getStatisticsApi} from "@/api/order/order";
@ -538,6 +539,13 @@ export default {
this.getList();
this.getHandover();
},
handoverShiftPrintingReceipt() {
handoverShiftPrintingReceipts(this.queryParams).then(res => {
this.dataList = res.data.records
this.total = res.data.total
})
},
getStaffList() {
listStaff(this.addDateRange({
page: 1,

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.order.dto.*;
import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.entity.AllOrderInfoRes;
import com.fuint.business.order.entity.CardBalanceChange;
import com.fuint.business.order.entity.CashierOrder;
import com.fuint.business.order.service.AllOrderInfoService;
@ -196,17 +197,6 @@ public class AllOrderInfoController extends BaseController {
return getSuccessResult(map);
}
@GetMapping("/findOrderStatistics")
public ResponseObject findOrderStatistics(AllOrderInfoRes allOrderInfoRes){
Map<String, Object> map = allOrderInfoService.findOrderStatistics(allOrderInfoRes);
return getSuccessResult(map);
}
@PostMapping("/exportExcelHandoverOrder")
public void exportExcelHandoverOrder(HttpServletResponse response, @RequestBody AllOrderInfoRes allOrderInfoRes) {
allOrderInfoService.exportExcelHandoverOrder(response, allOrderInfoRes);
}
/**
* 机构流水分析
*/

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.HandoverRecord;
import com.fuint.business.order.service.HandoverRecordService;
import com.fuint.business.printer.service.PrinterService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
@ -38,6 +39,9 @@ public class HandoverRecordController extends BaseController {
@Resource
private HandoverRecordService handoverRecordService;
@Resource
private PrinterService printerService;
/**
* 分页查询
*
@ -186,5 +190,15 @@ public class HandoverRecordController extends BaseController {
}
}
/**
* 交接班打印小票
* @return
*/
@PostMapping("handoverShiftPrintingReceipts")
public void handoverShiftPrintingReceipt(Integer staffId) {
Map<String, Object> handAll=handoverRecordService.handover3(staffId);
printerService.handoverShiftPrintingReceipt(handAll);
}
}

View File

@ -1,16 +0,0 @@
package com.fuint.business.order.dto;
import com.fuint.business.order.entity.AllOrderInfo;
import lombok.Data;
/**
* 油站端 - 封装请求参数实体
*/
@Data
public class AllOrderInfoRes extends AllOrderInfo {
/**
*用户手机号
*/
private String userMobile;
}

View File

@ -0,0 +1,120 @@
package com.fuint.business.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.business.order.vo.Excel.allorderVOo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
public class AllOrderInfoRes implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 订单号与业务表统一
*/
private String orderNo;
/**
* 类型1油品2商品3储值卡4积分5囤油卡6油品加商品(收银台订单)7挂账订单
*/
private String type;
/**
* 渠道订单号
*/
private String transactionId;
/**
* 店铺id
*/
private Integer storeId;
/**
* 找零金额
*/
private Double seekZero;
/**
* 原价
*/
private Double goodsMoney;
/**
* 支付金额
*/
private Double payMoney;
/**
* 优惠金额
*/
private Double discountAmount;
/**
* 支付时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date payTime;
/**
* 店员id
*/
private Integer staffId;
/**
* 付款方式数据字典
*/
private String payType;
/**
* 用户id
*/
private Integer userId;
/**
* 支付渠道小程序/收银台
*/
private String payChannel;
/**
* 状态0待支付数据字典
*/
private String status;
/**
* 订单描述
*/
private String content;
/**
* 退款原因
*/
private String reasonRefund;
/**
*商户号
*/
private String mchntCd;
/**
*支付通道
*/
private String paymentChannel;
/**
* 退款金额
*/
private Double refMoney;
/**
*商户id
*/
private Integer mId;
/**
* 退款订单
*/
private String refOrderNo;
private String refBy;
@TableField(exist = false)
List<allorderVOo> fenxiByDaili2;
@TableField(exist = false)
private Long deptId;
@TableField(exist = false)
private List<Long> storeIds;
@TableField(exist = false)
private String userName;
@TableField(exist = false)
private String[] dataRange;
}

View File

@ -8,6 +8,7 @@ import com.fuint.business.marketingActivity.cardValueRule.dto.CardValueOrdersDTO
import com.fuint.business.marketingActivity.cardValueRule.vo.CardValueOrdersVo;
import com.fuint.business.order.dto.*;
import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.entity.AllOrderInfoRes;
import com.fuint.business.order.entity.CardBalanceChange;
import com.fuint.business.order.entity.HandoverRecord;
import com.fuint.business.order.vo.AllOrderActivityVo;
@ -110,12 +111,6 @@ public interface AllOrderInfoMapper extends BaseMapper<AllOrderInfo> {
Double getCountMemberBalance(@Param("storeId") Integer storeId,@Param("endTime") String endTime);
AllOrderInfoVo selectByOrderNo(String orderNo);
Map<String, Object> findOrderStatistics(@Param("allOrderInfo") AllOrderInfoRes allOrderInfoRes,@Param("beginTime") String startTime, @Param("endTime") String endTime);
List getAllOrderInfo(@Param("obj") AllOrderInfoRes allOrderInfoRes,
@Param("beginTime") String beginTime, @Param("endTime") String endTime);
IPage<AllOrderInfoVo> transactionList(Page page,@Param("obj") AllOrderInfoRes allOrderInfoRes,
@Param("beginTime") String beginTime,@Param("endTime") String endTime);

View File

@ -111,5 +111,28 @@ public interface HandoverRecordMapper {
List<Map<String, Object>> returnedToTheAccount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId);
// 所有订单统计
Map<String, Object> oilOrderStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> paymentAggregation1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> oilNumberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> discountStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> backMoneyStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> billingDetails1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId);
List<Map<String, Object>> employeeStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> consumptionStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> goodsNumberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> IntegerNumberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> memberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> returnedToTheAccount1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId);
List<Map<String, Object>> staffStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId);
}

View File

@ -852,142 +852,6 @@
from all_order_info
where order_no = #{orderNo}
</select>
<select id="findOrderStatistics" resultType="java.util.Map">
SELECT
IFNULL(SUM(IF(aoi.pay_type = 'WECHAT', aoi.pay_money, 0)), 0) as wechat, -- 微信
IFNULL(SUM(IF(aoi.pay_type = 'WECHAT', 1, 0)), 0) as wechatCount, -- 笔数
IFNULL(SUM(IF(aoi.pay_type = 'ALIPAY', aoi.pay_money, 0)), 0) as alipay, -- 支付宝
IFNULL(SUM(IF(aoi.pay_type = 'ALIPAY', 1, 0)), 0) as alipayCount, -- 笔数
IFNULL(SUM(IF(aoi.pay_type = 'UNIONPAY', aoi.pay_money, 0)), 0) as unionPay, -- 云闪付
IFNULL(SUM(IF(aoi.pay_type = 'UNIONPAY', 1, 0)), 0) as unionPayCount, -- 笔数
IFNULL(SUM(IF(aoi.type = '8', aoi.pay_money, 0)), 0) as pos, -- POS
IFNULL(SUM(IF(aoi.type = '8', 1, 0)), 0) as posCount, -- 笔数
IFNULL(SUM(IF(aoi.pay_type = 'CASH', aoi.pay_money, 0)), 0) as cash, -- 现金
IFNULL(SUM(IF(aoi.pay_type = 'CASH', 1, 0)), 0) as cashCount, -- 笔数
IFNULL(SUM(IF(mu.id IS NOT NULL, aoi.pay_money, 0)), 0) as vip, -- 会员
IFNULL(SUM(IF(mu.id IS NOT NULL, 1, 0)), 0) as vipCount, -- 笔数
IFNULL(SUM(IF(aoi.pay_type = 'after_pay', aoi.pay_money, 0)), 0) AS afterPay, -- 挂账
IFNULL(SUM(IF(aoi.pay_type = 'after_pay', 1, 0)), 0) as afterPayCount -- 笔数
FROM
all_order_info aoi
LEFT JOIN mt_user mu ON aoi.user_id = mu.id
LEFT JOIN merchant_config mc ON mc.id = aoi.m_id
left join mt_staff ms on aoi.create_by=ms.id
where 1=1
<if test="allOrderInfo.orderNo != null and allOrderInfo.orderNo != ''">
and aoi.order_no like concat('%', #{allOrderInfo.orderNo}, '%')
</if>
<if test="allOrderInfo.payChannel != null and allOrderInfo.payChannel != ''">
and aoi.pay_channel = #{allOrderInfo.payChannel}
</if>
<if test="allOrderInfo.type != null and allOrderInfo.type != ''">
and aoi.type = #{allOrderInfo.type}
</if>
<if test="allOrderInfo.payType != null and allOrderInfo.payType != ''">
and aoi.pay_type = #{allOrderInfo.payType}
</if>
<if test="allOrderInfo.status != null and allOrderInfo.status != ''">
and aoi.status = #{allOrderInfo.status}
</if>
<if test="allOrderInfo.staffId != null and allOrderInfo.staffId != ''">
and aoi.create_by = #{allOrderInfo.staffId}
</if>
<if test="allOrderInfo.userMobile != null and allOrderInfo.userMobile != ''">
and mu.mobile like concat('%', #{allOrderInfo.userMobile}, '%')
</if>
<if test="beginTime != null and beginTime != ''">
<![CDATA[and aoi.create_time >= #{beginTime} ]]>
</if>
<if test="endTime != null and endTime != ''">
<![CDATA[ and aoi.create_time <= #{endTime} ]]>
</if>
</select>
<select id="getAllOrderInfo" resultType="com.fuint.business.order.vo.Excel.HandoverOrderExcel">
SELECT
ai.order_no,
CASE WHEN ai.pay_channel = 'cashier' THEN '收银台'
WHEN ai.pay_channel = 'POS' THEN 'POS机'
WHEN ai.pay_channel = 'PC' THEN '平台'
WHEN ai.pay_channel = 'applet' THEN '小程序'
END as payChannel,
CASE WHEN ai.type = '1' THEN '油品订单'
WHEN ai.type = '2' THEN '商品订单'
WHEN ai.type = '3' THEN '储值卡订单'
WHEN ai.type = '4' THEN '积分商城订单'
WHEN ai.type = '5' THEN '囤油卡订单'
WHEN ai.type = '6' THEN '收银台订单'
WHEN ai.type = '7' THEN '挂账订单'
WHEN ai.type = '8' THEN 'POS订单'
END as type,
ai.goods_money,
ai.discount_amount,
ai.pay_money as payMoney,
ai.pay_money as paysMoney,
ai.ref_money,
mu.mobile AS userMobile,
CASE WHEN ai.pay_type = 'ALIPAY' THEN '支付宝'
WHEN ai.pay_type = 'WECHAT' THEN '微信'
WHEN ai.pay_type = 'UNIONPAY' THEN '银联二维码'
WHEN ai.pay_type = 'CASH' THEN '现金'
WHEN ai.pay_type = 'APPLET_CODE' THEN '小程序码'
WHEN ai.pay_type = 'card_value' THEN '储值卡'
WHEN ai.pay_type = 'fule_card' THEN '囤油卡'
WHEN ai.pay_type = 'car_card_value' THEN '车队卡'
WHEN ai.pay_type = 'after_pay' THEN '挂账'
END as payType,
CASE WHEN ai.status = 'paid' THEN '已支付'
WHEN ai.status = 'unpaid' THEN '未支付'
WHEN ai.status = 'refund' THEN '已退款'
WHEN ai.status = 'payFail' THEN '支付失败'
WHEN ai.status = 'refunding' THEN '退款中'
END as status,
mt.account_name as createBy,
ai.create_time,
ai.update_time
FROM
all_order_info ai
LEFT JOIN mt_user mu ON ai.user_id = mu.id
LEFT JOIN merchant_config mc on mc.id = ai.m_id
left join t_account mt on ai.create_by=mt.acct_id
where 1=1
<if test="obj.storeId != null and obj.storeId != ''">
and ai.store_id = #{obj.storeId}
</if>
<if test="obj.paymentChannel != null and obj.paymentChannel != ''">
and ai.payment_channel = #{obj.paymentChannel}
</if>
<if test="obj.orderNo != null and obj.orderNo != ''">
and ai.order_no like concat('%', #{obj.orderNo}, '%')
</if>
<if test="obj.payType != null and obj.payType != ''">
and ai.pay_type = #{obj.payType}
</if>
<if test="obj.type != null and obj.type != ''">
and ai.type = #{obj.type}
</if>
<if test="obj.payChannel != null and obj.payChannel != ''">
and ai.pay_channel = #{obj.payChannel}
</if>
<if test="obj.userName != null and obj.userName != ''">
and mu.name like concat('%', #{obj.userName}, '%')
</if>
<if test="obj.status != null and obj.status != ''">
and ai.status = #{obj.status}
</if>
<if test="obj.staffId != null and obj.staffId != ''">
and ai.create_by = #{obj.staffId}
</if>
<if test="beginTime != null and beginTime != ''">
<![CDATA[and ai.create_time >= #{beginTime} ]]>
</if>
<if test="endTime != null and endTime != ''">
<![CDATA[ and ai.create_time <= #{endTime} ]]>
</if>
ORDER BY ai.create_time DESC
</select>
<select id="transactionList" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
SELECT
ai.*,
@ -1026,9 +890,6 @@
<if test="obj.staffId != null and obj.staffId != ''">
and ai.create_by = #{obj.staffId}
</if>
<if test="obj.userMobile != null and obj.userMobile != ''">
and mu.mobile = #{obj.userMobile}
</if>
<if test="beginTime != null and beginTime != ''">
<![CDATA[and ai.create_time >= #{beginTime} ]]>
</if>

View File

@ -585,5 +585,273 @@ limit 1
group by hb.credit_unit_id
</select>
<select id="oilOrderStatistics1" resultType="java.util.Map">
select
sum(if(status='paid',goods_money,0.00)) oilOrder,<!--订单金额-->
sum(if(status='paid',discount_amount,0.00)) oilRefund,<!--优惠金额-->
sum(if(status='refund',ref_money,0.00)) oilPaid,<!--退款金额-->
(select IFNULL(sum(amount),0.00) from hang_bill where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) onAccount,<!--挂账金额-->
sum(if(type='3',pay_money,0.00)) consumptionMoney,<!--消费金额-->
IFNULL(sum(pay_money),0.00) receiptsMoney,<!--实收金额-->
(select IFNULL(sum(pay_amount),0.00) from card_value_record where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) onAccount,<!--充值金额-->
(select IFNULL(sum(gift_balance),0.00) from card_value_record where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) giftAccount,<!--赠送金额-->
(select IFNULL(sum(card_balance),0.00) from mt_user_balance where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) memberBalance,<!--总余额-->
(select IFNULL(sum(points),0.00) from mt_user_balance where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) memberPoints,<!--总积分-->
(select IFNULL(sum(amount),0.00) from card_value_record where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) rechargeAll
from all_order_info
where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>
</select>
<select id="paymentAggregation1" resultType="java.util.Map">
SELECT
case when pay_type = 'ALIPAY' then '支付宝'
when pay_type = 'WECHAT' then '微信'
when pay_type = 'UNIONPAY' then '银联二维码'
when pay_type = 'CASH' then '现金'
when pay_type = 'APPLET_CODE' then '小程序码'
when pay_type = 'card_value' then '储值卡'
when pay_type = 'fule_card' then '囤油卡'
when pay_type = 'car_card_value' then '车队卡'
when pay_type = 'car_fule_card' then '车队囤油卡'
when pay_type = 'after_pay' then '挂账'
else '未知' end as payType
COUNT(id) as orderNum,
IFNULL(sum(pay_money)) as truePay
from all_order_info
where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>
GROUP BY pay_type with rollup
</select>
<select id="oilNumberStatistics1" resultType="java.util.Map">
SELECT
oil_name name,
COUNT(oo.id) orderNum,
SUM(pay_amount) payAmount
from
oil_order oo
LEFT JOIN oil_name onn
on onn.id=oo.oils
where onn.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>
GROUP BY onn.id with rollup
</select>
<select id="discountStatistics" resultType="java.util.Map">
SELECT
oil_name name,
sum(if(oo.discount_amount is not null,1,0)) orderNum,-- 订单金额
SUM(oo.discount_amount) discountAmount
from
oil_order oo
LEFT JOIN oil_name onn
on onn.id=oo.oils
where onn.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>
GROUP BY onn.id with rollup
</select>
<select id="backMoneyStatistics" resultType="java.util.Map">
SELECT
oil_name name,
sum(if(oo.ref_money is not null,1,0)) orderNum,-- 订单金额
SUM(oo.ref_money) refMoney
from
oil_order oo
LEFT JOIN oil_name onn
on onn.id=oo.oils
where onn.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime} and oo.ref_money is not null
<if test="staffId != null">
and staff_id = #{staffId}
</if>
GROUP BY onn.id with rollup
</select>
<select id="billingDetails1" resultType="java.util.Map">
SELECT cu.unit_name name,
COUNT(hb.id) orderNum,
SUM(amount) amount
from hang_bill hb
LEFT JOIN credit_unit cu on cu.id=hb.credit_unit_id
where onn.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>
GROUP BY cu.id with rollup
</select>
<select id="employeeStatistics1" resultType="java.util.Map">
SELECT
case when payment_type = 'ALIPAY' then '支付宝'
when payment_type = 'WECHAT' then '微信'
when payment_type = 'UNIONPAY' then '银联二维码'
when payment_type = 'CASH' then '现金'
when payment_type = 'APPLET_CODE' then '小程序码'
when payment_type = 'card_value' then '储值卡'
when payment_type = 'fule_card' then '囤油卡'
when payment_type = 'car_card_value' then '车队卡'
when payment_type = 'car_fule_card' then '车队囤油卡'
when payment_type = 'after_pay' then '挂账'
else '未知' end as payType,
COUNT(id) orderNum,
SUM(recharge_balance) rechargeBalance
from card_value_record
where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>
group by payment_type with rollup
</select>
<select id="consumptionStatistics" resultType="java.util.Map">
select * from(SELECT
'储蓄卡' as payType,
COUNT(id),
sum(balance) orderNum
from
card_balance_change
where change_type =0
and store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
union all
SELECT
'燃油卡' as payType,
COUNT(id),
sum(balance) orderNum
from
card_fuel_change
where change_type =0
and store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
union all
SELECT
'车队卡' as payType,
COUNT(id),
sum(adjust_limit) orderNum
from
fleet_lines_change
where adjust_type =0
and store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) a
GROUP BY payType
WITH ROLLUP
</select>
<select id="goodsNumberStatistics1" resultType="java.util.Map">
SELECT
case when pay_type = 'ALIPAY' then '支付宝'
when pay_type = 'WECHAT' then '微信'
when pay_type = 'UNIONPAY' then '银联二维码'
when pay_type = 'CASH' then '现金'
when pay_type = 'APPLET_CODE' then '小程序码'
when pay_type = 'card_value' then '储值卡'
when pay_type = 'fule_card' then '囤油卡'
when pay_type = 'car_card_value' then '车队卡'
when pay_type = 'car_fule_card' then '车队囤油卡'
when pay_type = 'after_pay' then '挂账'
else '未知' end as payType,
COUNT(id),
sum(pay_amount) payAmount
FROM
mt_order
where
store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
GROUP BY pay_type WITH ROLLUP
</select>
<select id="IntegerNumberStatistics1" resultType="java.util.Map">
SELECT
case when payment_type = 'ALIPAY' then '支付宝'
when payment_type = 'WECHAT' then '微信'
when payment_type = 'UNIONPAY' then '银联二维码'
when payment_type = 'CASH' then '现金'
when payment_type = 'APPLET_CODE' then '小程序码'
when payment_type = 'card_value' then '储值卡'
when payment_type = 'fule_card' then '囤油卡'
when payment_type = 'car_card_value' then '车队卡'
when payment_type = 'car_fule_card' then '车队囤油卡'
when payment_type = 'after_pay' then '挂账'
else '未知' end as payType,
COUNT(id),
sum(amount) amount
FROM
integral_orders
where
store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
GROUP BY payment_type WITH ROLLUP
</select>
<select id="memberStatistics1" resultType="java.util.Map">
select
count(id) as userNum
from
mt_user
where
store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
</select>
<select id="returnedToTheAccount1" resultType="java.util.Map">
select case when status = 'ALIPAY' then '支付宝'
when status = 'WECHAT' then '微信'
when status = 'UNIONPAY' then '银联二维码'
when status = 'CASH' then '现金'
when status = 'APPLET_CODE' then '小程序码'
when status = 'card_value' then '储值卡'
when status = 'fule_card' then '囤油卡'
when status = 'car_card_value' then '车队卡'
when status = 'car_fule_card' then '车队囤油卡'
when status = 'after_pay' then '挂账'
else '未知' end as status,
count(id) returnNum,
sum(amount) amount
from
return_record
where
store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
GROUP BY status WITH ROLLUP
</select>
<select id="staffStatistics" resultType="java.util.Map">
select ta.real_name,
COUNT(aoi.id),
sum(pay_money)
from t_account ta
left join all_order_info aoi on ta.acct_id=aoi.create_by
where
ta.store_id = #{storeId}
and ta.create_time BETWEEN #{startTime} AND #{endTime}
GROUP BY ta.acct_id WITH ROLLUP
</select>
</mapper>

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.order.dto.*;
import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.entity.AllOrderInfoRes;
import com.fuint.business.order.entity.CashierOrder;
import com.fuint.business.order.entity.HandoverRecord;
import com.fuint.business.order.vo.*;
@ -22,10 +23,6 @@ public interface AllOrderInfoService {
Map<String, Object> orderStatistics(AllOrderInfoRes allOrderInfoRes);
Map<String, Object> findOrderStatistics(AllOrderInfoRes allOrderInfoRes);
void exportExcelHandoverOrder(HttpServletResponse response, AllOrderInfoRes allOrderInfoRes);
/**
* 分页查询全部订单信息
* @param allOrderInfo

View File

@ -67,5 +67,6 @@ public interface HandoverRecordService {
public void printLocally(Map<String, Object> aa);
public Map<String, Object> handover3(Integer staffId);
}

View File

@ -26,13 +26,17 @@ import com.fuint.business.fleet.entity.FleetInfo;
import com.fuint.business.fleet.entity.FleetMember;
import com.fuint.business.fleet.mapper.FleetConsumeRecordMapper;
import com.fuint.business.fleet.mapper.FleetInfoMapper;
import com.fuint.business.fleet.mapper.FleetLinesChangeMapper;
import com.fuint.business.fleet.mapper.FleetMemberMapper;
import com.fuint.business.largeSscreen.vo.OrderGoodsVO;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelChangeMapper;
import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelRecordMapper;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.order.dto.*;
import com.fuint.business.order.entity.*;
import com.fuint.business.order.mapper.AllOrderInfoMapper;
@ -72,11 +76,13 @@ import com.fuint.system.dept.entity.SysDept;
import com.fuint.system.dept.mapper.SysDeptMapper;
import com.fuint.system.dept.service.ISysDeptService;
import com.fuint.system.dept.vo.SysDeptVo;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yaml.snakeyaml.reader.StreamReader;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@ -139,45 +145,6 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
allOrderInfoRes.getDataRange() == null ? "" : allOrderInfoRes.getDataRange()[1]);
}
@Override
public Map<String, Object> findOrderStatistics(AllOrderInfoRes allOrderInfoRes) {
String startTime = allOrderInfoRes.getDataRange() == null ? "" : allOrderInfoRes.getDataRange()[0];
String endTime = allOrderInfoRes.getDataRange() == null ? "" : allOrderInfoRes.getDataRange()[1];
return allOrderInfoMapper.findOrderStatistics(allOrderInfoRes, startTime , endTime);
}
@Override
public void exportExcelHandoverOrder(HttpServletResponse response, AllOrderInfoRes allOrderInfoRes) {
List<HandoverOrderExcel> list = getAllOrderInfo(allOrderInfoRes);
List<HandoverOrderExcel> tradingExcel = new ArrayList<>();
for (HandoverOrderExcel record : list) {
HandoverOrderExcel excel = new HandoverOrderExcel();
BeanUtils.copyProperties(record, excel);
excel.setType("其他");
tradingExcel.add(excel);
}
// 设置响应头信息
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=demo.xlsx");
try {
// 写入文件数据
EasyExcel.write(response.getOutputStream(), HandoverOrderExcel.class).sheet("交易明细").doWrite(tradingExcel);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
public List getAllOrderInfo(AllOrderInfoRes allOrderInfoRes) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
allOrderInfoRes.setStoreId(nowAccountInfo.getStoreId());
List list = super.baseMapper.getAllOrderInfo(allOrderInfoRes,
allOrderInfoRes.getDataRange().length == 0 ? "" : allOrderInfoRes.getDataRange()[0],
allOrderInfoRes.getDataRange().length == 0 ? "" : allOrderInfoRes.getDataRange()[1]);
return list;
}
@Override
public IPage<AllOrderInfoVo> getPageList(Page page, AllOrderInfo allOrderInfo) {
IPage<AllOrderInfoVo> pageList = allOrderInfoMapper.getPageList(page, allOrderInfo);

View File

@ -367,20 +367,14 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
// 普通收款(订单) 普通收款(退款) 普通收款(实收)
Map<String, Object> goodsOrderStatistics = handoverRecordMapper.goodsOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
// 会员总积分
Map<String, Object> stringObjectMap = userBalanceMapper.selectHoverBalance();
// 新增会员统计
Map<String, Object> stringObjectMap1 = userBalanceMapper.addNumberSum();
// 优惠金额
// 会员消费
// 实收
Map<String, Object> allOrderStatistics = handoverRecordMapper.allOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
if (!ObjectUtil.isEmpty(oilOrderStatistics)) {
allStatistics.putAll(oilOrderStatistics);
}else{
@ -1176,5 +1170,247 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
return totalReturnAmount;
}
@Override
public Map<String, Object> handover3(Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
MtStore mtStore = new MtStore();
try {
mtStore = storeService.queryStoreById2(nowAccountInfo.getStoreId());
} catch (BusinessCheckException e) {
e.printStackTrace();
}
// 获取当前日期
LocalDate today = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 格式化当前时间
String formattedEndTime = LocalDateTime.now().format(formatter);
Map<String, Object> handoverMap = new HashMap<>();
String startTime = "2023-01-01 12:12:12";
HandoverRecord handoverRecord = selectByTime(staffId);
if (!ObjectUtil.isEmpty(handoverRecord) && !ObjectUtil.isEmpty(handoverRecord.getEndTime())) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTime = sdf.format(handoverRecord.getEndTime());
}
String handoverType = "统一交班";
Integer staff = nowAccountInfo.getStaffId();
if (ObjectUtil.isNotEmpty(staffId)){
staff = staffId;
handoverType = "个人交班";
}
LJStaff ljStaff = iljStaffService.selectStaffById(staff);
// String handover = iSysDictDataService.selectDictLabel("handover", ljStaff.getHandoverMode());
// if (!ObjectUtil.isEmpty(handover)) {
// handoverType = handover;
// }
// 填充 baseInfo
Map<String, Object> baseInfo = new HashMap<>();
baseInfo.put("storeName", mtStore.getName());
baseInfo.put("realName", ljStaff.getRealName());
baseInfo.put("handoverType", handoverType);
baseInfo.put("startTime", startTime);
baseInfo.put("endTime", formattedEndTime);
// baseInfo.put("handoverPrem", ljStaff.getHandoverPrem()); // 交班权限
// baseInfo.put("handoverOut", ljStaff.getHandoverOut()); // 交班是否退出
handoverMap.put("baseInfo",baseInfo);
// 获取订单汇总
Map<String, Object> orderSummaryMap = orderSummary1(startTime, formattedEndTime, staffId);
handoverMap.put("orderSummary",orderSummaryMap);
// 支付方式汇总
List<Map<String, Object>> paymentAggregationMap = paymentAggregation1(startTime, formattedEndTime, staffId);
handoverMap.put("paymentAggregation",paymentAggregationMap);
// 油号统计
List<Map<String, Object>> oilNumberStatisticsMap = oilNumberStatistics(startTime, formattedEndTime, staffId);
handoverMap.put("oilNumberStatistics",oilNumberStatisticsMap);
// 优惠统计
List<Map<String, Object>> discountStatisticsMap = discountStatistics(startTime, formattedEndTime, staffId);
handoverMap.put("discountStatistics",discountStatisticsMap);
// 退款统计
List<Map<String, Object>> backMoneyStatisticsMap = backMoneyStatistics(startTime, formattedEndTime, staffId);
handoverMap.put("backMoneyStatistics",backMoneyStatisticsMap);
// 挂账统计
List<Map<String, Object>> billingDetailsMap = billingDetails1(startTime, formattedEndTime, staffId);
handoverMap.put("billingDetails",billingDetailsMap);
// 会员充值记录
List<Map<String, Object>> employeeStatisticsMap = employeeStatistics1(startTime, formattedEndTime, staffId);
handoverMap.put("employeeStatistics",employeeStatisticsMap);
// 会员消费统计
List<Map<String, Object>> consumptionStatisticsMap = consumptionStatistics(startTime, formattedEndTime, staffId);
handoverMap.put("consumptionStatistics",consumptionStatisticsMap);
// 便利店交易信息
List<Map<String, Object>> goodsNumberStatistics = goodsNumberStatistics1(startTime, formattedEndTime, staffId);
handoverMap.put("goodsNumberStatistics",goodsNumberStatistics);
// 积分商城兑换信息
List<Map<String, Object>> IntegerNumberStatistics = IntegerNumberStatistics1(startTime, formattedEndTime, staffId);
handoverMap.put("IntegerNumberStatistics",IntegerNumberStatistics);
// 会员新增统计
List<Map<String, Object>> memberStatisticsMap = memberStatistics1(startTime, formattedEndTime, staffId);
handoverMap.put("memberStatistics",memberStatisticsMap);
// 挂账归还
List<Map<String, Object>> returnedToTheAccountMap = returnedToTheAccount1(startTime, formattedEndTime, staffId) ;
handoverMap.put("returnedToTheAccount",returnedToTheAccountMap);
// 员工统计
List<Map<String, Object>> staffStatisticsMap = staffStatistics(startTime, formattedEndTime, staffId);
handoverMap.put("staffStatistics",staffStatisticsMap);
// huiyuan支付方式汇总
// List<Map<String, Object>> paymentAggregationMap = paymentAggregationByhuiyuan(startTime, formattedEndTime, staffId);
// handoverMap.put("paymentAggregation",paymentAggregationMap);
// 合计
return handoverMap;
}
public Map<String, Object> orderSummary1(String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Map<String, Object> allStatistics = new HashMap<>();
Map<String, Object> oilOrderStatistics = handoverRecordMapper.oilOrderStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
Double.valueOf(oilOrderStatistics.get("oilOrder").toString());
allStatistics.putAll(oilOrderStatistics);
allStatistics.put("operatingAmount", Double.valueOf(oilOrderStatistics.get("oilOrder").toString())- Double.valueOf(oilOrderStatistics.get("onAccount").toString()));
allStatistics.put("trueAmount", Double.valueOf(oilOrderStatistics.get("receiptsMoney").toString())- Double.valueOf(oilOrderStatistics.get("onAccount").toString()));
return allStatistics;
}
/**
* 汇总统计
*/
public List<Map<String, Object>> paymentAggregation1(String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> paymentAggregation = handoverRecordMapper.paymentAggregation1(startTime, endTime, nowAccountInfo.getStoreId(),staffId);
return paymentAggregation;
}
/**
* 油号统计
*/
public List<Map<String, Object>> oilNumberStatistics1 (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> oilNumberStatistics = handoverRecordMapper.oilNumberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return oilNumberStatistics;
}
/**
* 优惠统计
*/
public List<Map<String, Object>> discountStatistics (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> oilNumberStatistics = handoverRecordMapper.discountStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return oilNumberStatistics;
}
/**
* 退款统计
*/
public List<Map<String, Object>> backMoneyStatistics (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> oilNumberStatistics = handoverRecordMapper.backMoneyStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return oilNumberStatistics;
}
/**
* 挂账统计
* @param startTime
* @param endTime
* @param staffId
* @return
*/
public List<Map<String, Object>> billingDetails1 (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> billingDetails = handoverRecordMapper.billingDetails1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return billingDetails;
}
/**
* 会员卡充值统计
* @param startTime
* @param endTime
* @param staffId
* @return
*/
public List<Map<String, Object>> employeeStatistics1 (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> billingDetails = handoverRecordMapper.employeeStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return billingDetails;
}
/**
* 会员卡消费统计
* @param startTime
* @param endTime
* @param staffId
* @return
*/
public List<Map<String, Object>> consumptionStatistics (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> billingDetails = handoverRecordMapper.consumptionStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return billingDetails;
}
/**
* 便利店统计
* @param startTime
* @param endTime
* @param staffId
* @return
*/
public List<Map<String, Object>> goodsNumberStatistics1 (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> oilNumberStatistics = handoverRecordMapper.goodsNumberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return oilNumberStatistics;
}
/**
* 积分商城统计
* @param startTime
* @param endTime
* @param staffId
* @return
*/
public List<Map<String, Object>> IntegerNumberStatistics1 (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> oilNumberStatistics = handoverRecordMapper.IntegerNumberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return oilNumberStatistics;
}
/**
* 会员新增统计
* @param startTime
* @param endTime
* @param staffId
* @return
*/
public List<Map<String, Object>> memberStatistics1 (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> oilNumberStatistics = handoverRecordMapper.memberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return oilNumberStatistics;
}
/**
* 挂账归还
* @param startTime
* @param endTime
* @param staffId
* @return
*/
public List<Map<String, Object>> returnedToTheAccount1 (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> returnedToTheAccount = handoverRecordMapper.returnedToTheAccount1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return returnedToTheAccount;
}
/**
* 挂账归还
* @param startTime
* @param endTime
* @param staffId
* @return
*/
public List<Map<String, Object>> staffStatistics (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> returnedToTheAccount = handoverRecordMapper.staffStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return returnedToTheAccount;
}
}

View File

@ -1,40 +0,0 @@
package com.fuint.business.order.vo.Excel;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class HandoverOrderExcel {
@ExcelProperty("订单号")
private String orderNo; // 订单号
@ExcelProperty("订单类型")
private String payChannel; // 订单类型
@ExcelProperty("订单分类")
private String type; // 订单分类
@ExcelProperty("订单金额(元)")
private Double goodsMoney; // 订单金额
@ExcelProperty("优惠金额(元)")
private Double discountAmount; // 优惠金额
@ExcelProperty("实收金额(元)")
private Double payMoney; // 实收金额
@ExcelProperty("会员消费金额(元)")
private Double paysMoney; // 会员支付金额
@ExcelProperty("归还金额(元)")
private Double refMoney; // 归还金额
@ExcelProperty("用户手机号")
private String userMobile; // 用户手机号
@ExcelProperty("支付方式")
private String payType; // 支付方式
@ExcelProperty("订单状态")
private String status; // 订单状态
@ExcelProperty("关联员工")
private String createBy; // 收银员
@ExcelProperty("订单创建时间")
private Date createTime; // 支付时间
@ExcelProperty("订单完成时间")
private Date updateTime; // 支付时间
}

View File

@ -36,5 +36,5 @@ public interface PrinterService {
void printIntegralReport(Map<String, Object> integral, Integer storeId);
void handoverShiftPrintingReceipt(Map<String, Object> handAll);
}

View File

@ -16,7 +16,9 @@ import com.fuint.business.printer.vo.OrderPayment;
import com.fuint.business.setting.entity.ReceiptPrinting;
import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.RedisUtil;
import com.fuint.common.util.TokenUtil;
import com.fuint.repository.model.MtUser;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ -502,4 +504,36 @@ public class PrinterServiceImpl implements PrinterService {
return new String(content);
}
@Override
public void handoverShiftPrintingReceipt(Map<String, Object> handAll) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(nowAccountInfo.getStoreId());
Methods m=Methods.getInstance();
Object accessToken = RedisUtil.get("scancodemodel+" + nowAccountInfo.getStoreId());
if (ObjectUtil.isNotEmpty(accessToken)) {
m.init(accessToken.toString());
} else {
String token = getToken(nowAccountInfo.getStoreId());
if ("error".equals(token)) {
throw new RuntimeException("获取参数失败,无法打印");
}else {
m.init(token);
}
}
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
HandoverShiftPrintingReceipt.setHandover(handAll);
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
String url=m.print(infoByStoreId.getMachineCode(), HandoverShiftPrintingReceipt.printFeulOrder(), "Z"+System.currentTimeMillis()+random6.toString());
if (ObjectUtil.isNotEmpty(url)) {
// 使用 Fastjson JSON 字符串解析为 JSONObject
JSONObject jsonObject = JSON.parseObject(url);
String error = jsonObject.getString("error");
if ("18".equals(error)) {
getToken(nowAccountInfo.getStoreId());
}
}
}
}

View File

@ -0,0 +1,187 @@
package com.fuint.business.printer.template;
import cn.hutool.core.util.ObjectUtil;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class HandoverShiftPrintingReceipt {
public static Map<String, Object> handover = new HashMap<>();
public static String printFeulOrder() {
StringBuilder sb = new StringBuilder();
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDateTime = now.format(formatter);
System.out.println("当前时间:" + formattedDateTime);
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
sb.append("<ML>0</ML>");
sb.append("<center>门店交接单</center>"+"\r\n");
Map<String,String> o = (Map<String,String>)handover.get("baseInfo");
sb.append("油站名称:"+o.get("storeName") +"\r\n");
sb.append("油站站长:"+o.get("realName") +"\r\n");
sb.append("交班方式:"+o.get("handoverType") +"\r\n");
sb.append("开始时间:"+o.get("startTime") +"\r\n");
sb.append("结束时间:"+o.get("endTime") +"\r\n");
Map<String,String> o1 = (Map<String,String>)handover.get("orderSummary");
sb.append("订单金额:"+String.valueOf(o1.get("oilOrder"))+"\r\n");
sb.append("优惠金额:"+String.valueOf(o1.get("allDis")) +"\r\n");
sb.append("退款金额:"+String.valueOf(o1.get("oilRefund")) +"\r\n");
sb.append("挂账金额:"+String.valueOf(o1.get("startTime")) +"\r\n");
sb.append("消费金额:"+String.valueOf(o1.get("allBalanceP")) +"\r\n");
sb.append("实收金额:"+String.valueOf(o1.get("allMoney")) +"\r\n");
sb.append("充值金额:"+String.valueOf(o1.get("cardPaid")) +"\r\n");
sb.append("充值赠送:"+String.valueOf(o1.get("cardGiftPaid")) +"\r\n");
sb.append("会员总余额:"+String.valueOf(o1.get("points")) +"\r\n");
sb.append("会员总积分:"+String.valueOf(o1.get("sumnum")) +"\r\n");
sb.append("<center>---------------------------</center>"+"\r\n");
sb.append("<center>------营业收入统计------</center>"+"\r\n");
sb.append("<table><tr><td>类型</td><td>订单金额</td><td>实收金额</td></tr>");
sb.append("<tr><td>营业总额</td>");
sb.append("<td>"+String.valueOf(o1.get("allyingye1"))+"</td>");
sb.append("<td>"+ String.valueOf(o1.get("allyingye"))+"</td></tr>");
sb.append("<tr><td>充值总额</td>");
sb.append("<td>"+String.valueOf(o1.get("allchuzhika1"))+"</td>");
sb.append("<td>"+ String.valueOf(o1.get("allchuzhika"))+"</td></tr>");
sb.append("<tr><td>合计</td>");
sb.append("<td>"+String.valueOf(o1.get("allyingye1"))+"</td>");
sb.append("<td>"+String.valueOf(o1.get("allchuzhika1"))+"</td></tr>");
sb.append("</table>");
sb.append("<center>------支付方式统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付方式</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o2 = (List<Map<String,String>>)handover.get("paymentAggregation");
for(int i=0;i<o2.size();i++){
if("ALIPAY".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>支付宝</td>");
}else if("WECHAT".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>微信</td>");
}else if("UNIONPAY".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>银联二维码</td>");
}else if("CASH".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>现金</td>");
}else if("balance".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>余额</td>");
}else if("card_value".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>油卡</td>");
}else {
sb.append("<tr><td>其余</td>");
}
sb.append("<td>"+String.valueOf(o2.get(i).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o2.get(i).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------油品实收统计------</center>"+"\r\n");
sb.append("<table><tr><td>油号</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o3 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o3.size();m++){
sb.append("<tr><td>"+String.valueOf(o3.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o3.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o3.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------优惠统计------</center>"+"\r\n");
sb.append("<table><tr><td>油号</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o4 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o4.size();m++){
sb.append("<tr><td>"+String.valueOf(o4.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o4.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o4.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------退款统计------</center>"+"\r\n");
sb.append("<table><tr><td>油号</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o5 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o5.size();m++){
sb.append("<tr><td>"+String.valueOf(o5.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o5.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o5.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------挂账统计------</center>"+"\r\n");
sb.append("<table><tr><td>关账单位</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o6 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o6.size();m++){
sb.append("<tr><td>"+String.valueOf(o6.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o6.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o6.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------会员充值统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o7 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o7.size();m++){
sb.append("<tr><td>"+String.valueOf(o7.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o7.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o7.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------会员消费统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o8 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o8.size();m++){
sb.append("<tr><td>"+String.valueOf(o8.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o8.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o8.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------便利店统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o9 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o9.size();m++){
sb.append("<tr><td>"+String.valueOf(o9.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o9.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o9.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------积分商城统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付方式</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o10 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o10.size();m++){
sb.append("<tr><td>"+String.valueOf(o10.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o10.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o10.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------新增会员统计------</center>"+"\r\n");
sb.append("<table><tr><td>新增会员数</td><td>实收金额</td></tr>");
List<Map<String,String>> o11 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o11.size();m++){
sb.append("<tr><td>"+String.valueOf(o11.get(m).get("oilName"))+"</td>");
sb.append("<td>"+ String.valueOf(o11.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------挂账会换统计(在处理)------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o12 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o12.size();m++){
sb.append("<tr><td>"+String.valueOf(o12.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o12.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o12.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------员工实收统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o13 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o13.size();m++){
sb.append("<tr><td>"+String.valueOf(o13.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o13.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o13.get(m).get("paidAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("--------------------------------\r\n");
return sb.toString();
}
public static Map<String, Object> getHandover() {
return handover;
}
public static void setHandover(Map<String, Object> handover) {
HandoverShiftPrintingReceipt.handover = handover;
}
}