Compare commits

...

2 Commits

Author SHA1 Message Date
sw
1af2d0861b 油站财务报表,交易 2024-11-07 15:09:32 +08:00
sw
829d0a9f15 油站财务报表,交易 2024-11-07 09:21:08 +08:00
18 changed files with 1084 additions and 347 deletions

View File

@ -44,3 +44,18 @@ export function printLocallyApi(data) {
data: data data: data
}) })
} }
export function handoverShiftPrintingReceipts(data) {
return request({
url: '/business/handoverRecord/handoverShiftPrintingReceipts',
method: 'post',
data: data
})
}
export function handoverShiftPrintingReceiptss(data) {
return request({
url: '/business/handoverRecord/handoverShiftPrintingReceiptss',
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 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: 5%;"></div>
<div style="width: 80%;">门店交接单</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>
<div class="d-s-b"> <div class="d-s-b">
<div>油站名称</div> <div>油站名称</div>
@ -68,39 +68,39 @@
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div>优惠金额</div> <div>优惠金额</div>
<div>{{ orderSummary.allDis }}</div>
</div>
<div class="d-s-b">
<div>退款金额</div>
<div>{{ orderSummary.oilRefund }}</div> <div>{{ orderSummary.oilRefund }}</div>
</div> </div>
<div class="d-s-b">
<div>退款金额</div>
<div>{{ orderSummary.oilPaid }}</div>
</div>
<div class="d-s-b"> <div class="d-s-b">
<div>挂账金额</div> <div>挂账金额</div>
<div>--</div> <div>{{ orderSummary.onAccount }}</div>
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div>会员消费</div> <div>会员消费</div>
<div>{{ orderSummary.allBalanceP }}</div> <div>{{ orderSummary.consumptionMoney }}</div>
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div>实收金额</div> <div>实收金额</div>
<div>{{ orderSummary.allMoney }}</div> <div>{{ orderSummary.receiptsMoney }}</div>
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div>充值金额</div> <div>充值金额</div>
<div>{{ orderSummary.cardPaid }}</div> <div>{{ orderSummary.onAccount }}</div>
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div>充值赠送</div> <div>充值赠送</div>
<div>{{ orderSummary.cardGiftPaid }}</div> <div>{{ orderSummary.giftAccount }}</div>
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div>会员总余额</div> <div>会员总余额</div>
<div>{{ orderSummary.points }}</div> <div>{{ orderSummary.memberBalance }}</div>
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div>会员总积分</div> <div>会员总积分</div>
<div>{{ orderSummary.sumnum }}</div> <div>{{ orderSummary.memberPoints }}</div>
</div> </div>
<div class="xxing"></div> <div class="xxing"></div>
<div style="width: 100%; height: 29vh;overflow: auto;scrollbar-width: none; "> <div style="width: 100%; height: 29vh;overflow: auto;scrollbar-width: none; ">
@ -117,18 +117,18 @@
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div class="l-size">营业总额</div> <div class="l-size">营业总额</div>
<div class="s-size">{{ orderSummary.allyingye1 }}</div> <div class="s-size">{{ orderSummary.oilOrder }}</div>
<div class="r-size">{{ orderSummary.allyingye }}</div> <div class="r-size">{{ orderSummary.receiptsMoney }}</div>
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div class="l-size">充值总额</div> <div class="l-size">充值总额</div>
<div class="s-size">{{ orderSummary.allchuzhika1 }}</div> <div class="s-size">{{ orderSummary.rechargeAll }}</div>
<div class="r-size">{{ orderSummary.allchuzhika }}</div> <div class="r-size">{{ orderSummary.onAccount }}</div>
</div> </div>
<div class="d-s-b"> <div class="d-s-b">
<div class="l-size">合计</div> <div class="l-size">合计</div>
<div class="s-size">{{ orderSummary.allyingye1 + orderSummary.allchuzhika1 }}</div> <div class="s-size">{{ orderSummary.orderall}}</div>
<div class="r-size">{{ orderSummary.allyingye + orderSummary.allchuzhika }}</div> <div class="r-size">{{ orderSummary.orderalls}}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -143,9 +143,9 @@
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'all'"> <div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'all'">
<div class="l-size">{{ calculateThePaymentMethod(item.payType) }}</div> <div class="l-size">{{item.payType}}</div>
<div class="s-size">{{ item.numberOfDeals }}</div> <div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.paidAmount }}</div> <div class="r-size">{{ item.truePay }}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -160,9 +160,9 @@
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in oilNumberStatistics"> <div class="d-s-b" v-for="item in oilNumberStatistics">
<div class="l-size">{{ item.oilName }}</div> <div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.numberOfDeals }}</div> <div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.paidAmount }}</div> <div class="r-size">{{ item.payAmount }}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -176,10 +176,10 @@
<div class="f-size">笔数</div> <div class="f-size">笔数</div>
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in oilNumberStatistics"> <div class="d-s-b" v-for="item in discountStatistics">
<div class="l-size">{{ item.oilName }}</div> <div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.numberOfDeals }}</div> <div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.paidAmount }}</div> <div class="r-size">{{ item.discountAmount }}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -189,14 +189,14 @@
<div class="x-"></div> <div class="x-"></div>
</div> </div>
<div class="d-s-b" style="font-weight: 600"> <div class="d-s-b" style="font-weight: 600">
<div class="l-size">类型</div> <div class="l-size">油号</div>
<div class="f-size">笔数</div> <div class="f-size">笔数</div>
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in oilNumberStatistics"> <div class="d-s-b" v-for="item in backMoneyStatistics">
<div class="l-size">{{ item.oilName }}</div> <div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.numberOfDeals }}</div> <div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.paidAmount }}</div> <div class="r-size">{{ item.refMoney }}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -210,10 +210,10 @@
<div class="f-size">笔数</div> <div class="f-size">笔数</div>
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'all' && item.payType == 'balance'"> <div class="d-s-b" v-for="item in billingDetails">
<div class="l-size">{{ item.name }}</div> <div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div> <div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div> <div class="r-size">{{ item.amount}}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -227,10 +227,10 @@
<div class="f-size">笔数</div> <div class="f-size">笔数</div>
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'allbalance'"> <div class="d-s-b" v-for="item in employeeStatistics">
<div class="l-size">{{ calculateThePaymentMethod(item.payType) }}</div> <div class="l-size">{{item.payType}}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div> <div class="s-size">{{ item.orderNum}}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div> <div class="r-size">{{ item.rechargeBalance}}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -244,10 +244,10 @@
<div class="f-size">笔数</div> <div class="f-size">笔数</div>
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'all' && item.payType == 'balance'"> <div class="d-s-b" v-for="item in consumptionStatistics">
<div class="l-size">合计</div> <div class="l-size">{{ item.payType}}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div> <div class="s-size">{{ item.orderNums }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div> <div class="r-size">{{item.orderNum}}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -261,10 +261,10 @@
<div class="f-size">笔数</div> <div class="f-size">笔数</div>
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'goods'"> <div class="d-s-b" v-for="item in goodsNumberStatistics">
<div class="l-size">{{ calculateThePaymentMethod(item.payType) }}</div> <div class="l-size">{{item.payType}}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div> <div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div> <div class="r-size">{{ item.payAmount}}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -278,10 +278,10 @@
<div class="f-size">笔数</div> <div class="f-size">笔数</div>
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'point'"> <div class="d-s-b" v-for="item in integerNumberStatistics">
<div class="l-size">{{ calculateThePaymentMethod(item.payType) }}</div> <div class="l-size">{{item.payType }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div> <div class="s-size">{{ item.orderNum}}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div> <div class="r-size">{{ item.amount}}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -293,14 +293,14 @@
<div class="d-s-b" style="font-weight: 600"> <div class="d-s-b" style="font-weight: 600">
<div class="l-size">新增会员数</div> <div class="l-size">新增会员数</div>
<!-- <div class="f-size">笔数</div>--> <!-- <div class="f-size">笔数</div>-->
<div class="r-size">{{ orderSummary.sumnum }}</div> <div class="r-size">{{ memberStatistics.userNum }}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
<div class="for-title"> <div class="for-title">
<div class="x-"></div> <div class="x-"></div>
<div>挂账归还统计(再处理)</div> <div>挂账归还统计</div>
<div class="x-"></div> <div class="x-"></div>
</div> </div>
<div class="d-s-b" style="font-weight: 600"> <div class="d-s-b" style="font-weight: 600">
@ -309,9 +309,9 @@
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in returnedToTheAccount"> <div class="d-s-b" v-for="item in returnedToTheAccount">
<div class="l-size">{{ item.name ? item.name : '--' }}</div> <div class="l-size">{{ item.status }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div> <div class="s-size">{{ item.returnNum }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div> <div class="r-size">{{ item.amount}}</div>
</div> </div>
</div> </div>
<div class="for-box"> <div class="for-box">
@ -325,10 +325,10 @@
<div class="f-size">笔数</div> <div class="f-size">笔数</div>
<div class="r-size">实收金额</div> <div class="r-size">实收金额</div>
</div> </div>
<div class="d-s-b" v-for="item in employeeStatistics"> <div class="d-s-b" v-for="item in staffStatistics">
<div class="l-size">{{ item.name ? item.name : '--' }}</div> <div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div> <div class="s-size">{{ item.staffNum }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div> <div class="r-size">{{ item.monye}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -352,7 +352,9 @@ import {
getHandoverApi, getHandoverApi,
getHandoverApi2, getHandoverApi2,
getHandoverListApi, getHandoverListApi,
printLocallyApi printLocallyApi,
handoverShiftPrintingReceipts,
handoverShiftPrintingReceiptss
} from "@/api/handover/handover"; } from "@/api/handover/handover";
import {getStatisticsApi} from "@/api/order/order"; import {getStatisticsApi} from "@/api/order/order";
@ -369,7 +371,33 @@ export default {
data() { data() {
return { return {
baseInfo : {},
//
orderSummary : {},
//
paymentAggregation :[],
//
oilNumberStatistics:[],
//
discountStatistics:[],
//退
backMoneyStatistics:[],
//
billingDetails :[],
//
employeeStatistics:[],
//
consumptionStatistics:[],
//便
goodsNumberStatistics:[],
//
integerNumberStatistics:[],
//
memberStatistics:{},
//
returnedToTheAccount:[],
//
staffStatistics:[],
tabs: [ tabs: [
"交接班", "交接班",
// "1", // "1",
@ -386,14 +414,7 @@ export default {
shiftHandoverList: '', shiftHandoverList: '',
handoverList: {}, handoverList: {},
handoverData: {}, handoverData: {},
baseInfo: {},
billingDetails: [],
employeeStatistics: [],
greaseGunStatistics: [], greaseGunStatistics: [],
oilNumberStatistics: [],
orderSummary: {},
paymentAggregation: [],
returnedToTheAccount: [],
// base // base
queryParams: { queryParams: {
@ -422,10 +443,10 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getHandover(); //this.getHandover();
this.getStatistics(); // this.getStatistics();
this.getStatus(); // this.getStatus();
this.getStaffList(); // this.getStaffList();
}, },
mounted() { mounted() {
this.queryParams.status = '统一交班'; this.queryParams.status = '统一交班';
@ -468,22 +489,53 @@ export default {
this.tabindex = index this.tabindex = index
}, },
getList() { getList() {
this.dateRange = [] // this.dateRange = []
if (this.beginTime && this.endTime) { // if (this.beginTime && this.endTime) {
this.dateRange.push(this.beginTime.toLocaleDateString()) // this.dateRange.push(this.beginTime.toLocaleDateString())
this.dateRange.push(this.endTime.toLocaleDateString()) // this.dateRange.push(this.endTime.toLocaleDateString())
} // }
getHandoverListApi(this.addDateRange(this.queryParams, this.dateRange)).then(res => { // getHandoverListApi(this.addDateRange(this.queryParams, this.dateRange)).then(res => {
// this.dataList = res.data.records
// this.total = res.data.total
//
// })
handoverShiftPrintingReceiptss(this.queryParams).then(res => {
this.handoverData = res.data;
this.baseInfo = this.handoverData.baseInfo,
//
this.orderSummary = this.handoverData.orderSummary,
//
this.paymentAggregation = this.handoverData.paymentAggregation,
//
this.oilNumberStatistics = this.handoverData.oilNumberStatistics,
//
this.discountStatistics = this.handoverData.discountStatistics,
//退
this.backMoneyStatistics = this.handoverData.backMoneyStatistics,
//
this.billingDetails = this.handoverData.billingDetails,
//
this.employeeStatistics = this.handoverData.employeeStatistics,
//
this.consumptionStatistics = this.handoverData.consumptionStatistics,
//便
this.goodsNumberStatistics = this.handoverData.goodsNumberStatistics,
//
this.integerNumberStatistics = this.handoverData.integerNumberStatistics,
//
this.memberStatistics = this.handoverData.memberStatistics,
//
this.returnedToTheAccount = this.handoverData.returnedToTheAccount,
//
this.staffStatistics = this.handoverData.staffStatistics,
this.dataList = res.data.records this.dataList = res.data.records
this.total = res.data.total this.total = res.data.total
}) })
}, },
getStatistics() { getStatistics() {
getStatisticsApi().then(res => { getStatisticsApi().then(res => {
this.statisticsForm = res.data this.statisticsForm = res.data
}) })
console.log("123123123", this.statisticsForm)
}, },
// //
@ -538,6 +590,13 @@ export default {
this.getList(); this.getList();
this.getHandover(); this.getHandover();
}, },
handoverShiftPrintingReceipt() {
handoverShiftPrintingReceipts(this.queryParams).then(res => {
this.dataList = res.data.records
this.total = res.data.total
})
},
getStaffList() { getStaffList() {
listStaff(this.addDateRange({ listStaff(this.addDateRange({
page: 1, 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.integral.entity.IntegralDetail;
import com.fuint.business.order.dto.*; import com.fuint.business.order.dto.*;
import com.fuint.business.order.entity.AllOrderInfo; 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.CardBalanceChange;
import com.fuint.business.order.entity.CashierOrder; import com.fuint.business.order.entity.CashierOrder;
import com.fuint.business.order.service.AllOrderInfoService; import com.fuint.business.order.service.AllOrderInfoService;
@ -196,17 +197,6 @@ public class AllOrderInfoController extends BaseController {
return getSuccessResult(map); 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.HandoverRecord; import com.fuint.business.order.entity.HandoverRecord;
import com.fuint.business.order.service.HandoverRecordService; import com.fuint.business.order.service.HandoverRecordService;
import com.fuint.business.printer.service.PrinterService;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController; import com.fuint.framework.web.BaseController;
@ -38,6 +39,9 @@ public class HandoverRecordController extends BaseController {
@Resource @Resource
private HandoverRecordService handoverRecordService; private HandoverRecordService handoverRecordService;
@Resource
private PrinterService printerService;
/** /**
* 分页查询 * 分页查询
* *
@ -186,5 +190,23 @@ public class HandoverRecordController extends BaseController {
} }
} }
/**
* 交接班打印小票
* @return
*/
@PostMapping("handoverShiftPrintingReceipts")
public void handoverShiftPrintingReceipt(Integer staffId) {
Map<String, Object> handAll=handoverRecordService.handover3(staffId);
printerService.handoverShiftPrintingReceipt(handAll);
} }
/**
* 交接班打印
* @return
*/
@PostMapping("handoverShiftPrintingReceiptss")
public ResponseObject handoverShiftPrintingReceiptss(Integer staffId) {
return getSuccessResult(handoverRecordService.handover3(staffId));
}
}

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.marketingActivity.cardValueRule.vo.CardValueOrdersVo;
import com.fuint.business.order.dto.*; import com.fuint.business.order.dto.*;
import com.fuint.business.order.entity.AllOrderInfo; 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.CardBalanceChange;
import com.fuint.business.order.entity.HandoverRecord; import com.fuint.business.order.entity.HandoverRecord;
import com.fuint.business.order.vo.AllOrderActivityVo; 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); Double getCountMemberBalance(@Param("storeId") Integer storeId,@Param("endTime") String endTime);
AllOrderInfoVo selectByOrderNo(String orderNo); 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, IPage<AllOrderInfoVo> transactionList(Page page,@Param("obj") AllOrderInfoRes allOrderInfoRes,
@Param("beginTime") String beginTime,@Param("endTime") String endTime); @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); 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);
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 from all_order_info
where order_no = #{orderNo} where order_no = #{orderNo}
</select> </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 id="transactionList" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
SELECT SELECT
ai.*, ai.*,
@ -1026,9 +890,6 @@
<if test="obj.staffId != null and obj.staffId != ''"> <if test="obj.staffId != null and obj.staffId != ''">
and ai.create_by = #{obj.staffId} and ai.create_by = #{obj.staffId}
</if> </if>
<if test="obj.userMobile != null and obj.userMobile != ''">
and mu.mobile = #{obj.userMobile}
</if>
<if test="beginTime != null and beginTime != ''"> <if test="beginTime != null and beginTime != ''">
<![CDATA[and ai.create_time >= #{beginTime} ]]> <![CDATA[and ai.create_time >= #{beginTime} ]]>
</if> </if>

View File

@ -585,5 +585,304 @@ limit 1
group by hb.credit_unit_id group by hb.credit_unit_id
</select> </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(recharge_balance),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(bid_balance),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),0.00) 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
case when a.`name` is not null then a.`name` else '合计'
end as name,
COUNT(a.orderNum) orderNum,
IFNULL(SUM(a.payAmount),0) payAmount
from(
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 oo.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>) a
GROUP BY a.`name` with rollup
</select>
<select id="discountStatistics" resultType="java.util.Map">
select
case when a.`name` is not null then a.`name` else '合计'
end as name,
COUNT(a.orderNum) orderNum,
IFNULL(SUM(a.discountAmount),0) discountAmount
from(
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 oo.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>) a
GROUP BY a.`name` with rollup
</select>
<select id="backMoneyStatistics" resultType="java.util.Map">
select
case when a.`name` is not null then a.`name` else '合计'
end as name,
COUNT(a.orderNum) orderNum,
IFNULL(SUM(a.refMoney),0) refMoney
from( 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 oo.store_id = 157
and oo.ref_money is not null
) a
GROUP BY a.`name` with rollup
</select>
<select id="billingDetails1" resultType="java.util.Map">
SELECT
case when a.`name` is not null then a.`name` else '合计'
end as name,
COUNT(a.orderNum) orderNum,
IFNULL(SUM(a.amount),0) amount
from (SELECT
cu.unit_name as `name`,
hb.id orderNum,
amount amount
from hang_bill hb
LEFT JOIN credit_unit cu on cu.id=hb.credit_unit_id
where hb.store_id = #{storeId}
and hb.create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>) a
GROUP BY a.`name` 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 '挂账'
when payment_type is null then '合计'
else '未知' end as payType,
COUNT(id) orderNum,
IFNULL(SUM(recharge_balance),0.00) 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) as orderNums,
IFNULL(sum(balance),0.00) 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) as orderNum,
IFNULL(sum(balance),0.00) 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) as orderNum,
IFNULL(sum(adjust_limit),0.00) orderNum
from
fleet_lines_change
where adjust_type =0
and store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) a
GROUP BY payType
</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 '挂账'
when pay_type is null then '合计'
else '未知' end as payType,
COUNT(id) as orderNum,
IFNULL(sum(pay_amount),0.00) 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 '挂账'
when payment_type is null then '合计'
else '未知' end as payType,
COUNT(id) as orderNum,
IFNULL(sum(amount),0.00) 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 '挂账'
when status is null then '合计'
else '未知' end as status,
count(id) returnNum,
IFNULL(sum(amount),0.00) 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 case
when a.`name` is not null then a.`name`
else '合计'
end as name,
COUNT(a.staffNum) staffNum,
IFNULL(SUM(a.monye), 0) monye
from (select
ta.real_name as name,
COUNT(aoi.id) as staffNum,
IFNULL(sum(pay_money), 0.00) as monye
from t_account ta
left join all_order_info aoi on ta.acct_id = aoi.create_by
where ta.store_id = #{storeId}
and aoi.create_time BETWEEN #{startTime} AND #{endTime}) a
GROUP BY a.`name` WITH ROLLUP
</select>
</mapper> </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.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.order.dto.*; import com.fuint.business.order.dto.*;
import com.fuint.business.order.entity.AllOrderInfo; 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.CashierOrder;
import com.fuint.business.order.entity.HandoverRecord; import com.fuint.business.order.entity.HandoverRecord;
import com.fuint.business.order.vo.*; import com.fuint.business.order.vo.*;
@ -22,10 +23,6 @@ public interface AllOrderInfoService {
Map<String, Object> orderStatistics(AllOrderInfoRes allOrderInfoRes); Map<String, Object> orderStatistics(AllOrderInfoRes allOrderInfoRes);
Map<String, Object> findOrderStatistics(AllOrderInfoRes allOrderInfoRes);
void exportExcelHandoverOrder(HttpServletResponse response, AllOrderInfoRes allOrderInfoRes);
/** /**
* 分页查询全部订单信息 * 分页查询全部订单信息
* @param allOrderInfo * @param allOrderInfo

View File

@ -67,5 +67,6 @@ public interface HandoverRecordService {
public void printLocally(Map<String, Object> aa); 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.entity.FleetMember;
import com.fuint.business.fleet.mapper.FleetConsumeRecordMapper; import com.fuint.business.fleet.mapper.FleetConsumeRecordMapper;
import com.fuint.business.fleet.mapper.FleetInfoMapper; 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.fleet.mapper.FleetMemberMapper;
import com.fuint.business.largeSscreen.vo.OrderGoodsVO; import com.fuint.business.largeSscreen.vo.OrderGoodsVO;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper; import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange; 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.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.dto.*;
import com.fuint.business.order.entity.*; import com.fuint.business.order.entity.*;
import com.fuint.business.order.mapper.AllOrderInfoMapper; 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.mapper.SysDeptMapper;
import com.fuint.system.dept.service.ISysDeptService; import com.fuint.system.dept.service.ISysDeptService;
import com.fuint.system.dept.vo.SysDeptVo; import com.fuint.system.dept.vo.SysDeptVo;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.yaml.snakeyaml.reader.StreamReader;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -139,45 +145,6 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
allOrderInfoRes.getDataRange() == null ? "" : allOrderInfoRes.getDataRange()[1]); 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 @Override
public IPage<AllOrderInfoVo> getPageList(Page page, AllOrderInfo allOrderInfo) { public IPage<AllOrderInfoVo> getPageList(Page page, AllOrderInfo allOrderInfo) {
IPage<AllOrderInfoVo> pageList = allOrderInfoMapper.getPageList(page, 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> goodsOrderStatistics = handoverRecordMapper.goodsOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
// 会员总积分 // 会员总积分
Map<String, Object> stringObjectMap = userBalanceMapper.selectHoverBalance(); Map<String, Object> stringObjectMap = userBalanceMapper.selectHoverBalance();
// 新增会员统计 // 新增会员统计
Map<String, Object> stringObjectMap1 = userBalanceMapper.addNumberSum(); Map<String, Object> stringObjectMap1 = userBalanceMapper.addNumberSum();
// 优惠金额 // 优惠金额
// 会员消费 // 会员消费
// 实收 // 实收
Map<String, Object> allOrderStatistics = handoverRecordMapper.allOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId); Map<String, Object> allOrderStatistics = handoverRecordMapper.allOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
if (!ObjectUtil.isEmpty(oilOrderStatistics)) { if (!ObjectUtil.isEmpty(oilOrderStatistics)) {
allStatistics.putAll(oilOrderStatistics); allStatistics.putAll(oilOrderStatistics);
}else{ }else{
@ -1176,5 +1170,249 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
return totalReturnAmount; 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);
orderSummaryMap.put("orderall",Double.valueOf(orderSummaryMap.get("oilOrder").toString())+Double.valueOf(orderSummaryMap.get("rechargeAll").toString()));
orderSummaryMap.put("orderalls",Double.valueOf(orderSummaryMap.get("receiptsMoney").toString())+Double.valueOf(orderSummaryMap.get("onAccount").toString()));
handoverMap.put("orderSummary",orderSummaryMap);
// 支付方式汇总
List<Map<String, Object>> paymentAggregationMap = paymentAggregation1(startTime, formattedEndTime, staffId);
handoverMap.put("paymentAggregation",paymentAggregationMap);
// 油号统计
List<Map<String, Object>> oilNumberStatisticsMap = oilNumberStatistics1(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);
// 会员新增统计
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 Map<String, Object> memberStatistics1 (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
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 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.setting.entity.ReceiptPrinting;
import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.entity.UserBalance; import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.RedisUtil; import com.fuint.common.util.RedisUtil;
import com.fuint.common.util.TokenUtil;
import com.fuint.repository.model.MtUser; import com.fuint.repository.model.MtUser;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@ -502,4 +504,36 @@ public class PrinterServiceImpl implements PrinterService {
return new String(content); 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,172 @@
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.math.BigDecimal;
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("oilRefund")) +"\r\n");
sb.append("退款金额:"+String.valueOf(o1.get("oilPaid")) +"\r\n");
sb.append("挂账金额:"+String.valueOf(o1.get("onAccount")) +"\r\n");
sb.append("消费金额:"+String.valueOf(o1.get("consumptionMoney")) +"\r\n");
sb.append("实收金额:"+String.valueOf(o1.get("receiptsMoney")) +"\r\n");
sb.append("充值金额:"+String.valueOf(o1.get("onAccount")) +"\r\n");
sb.append("充值赠送:"+String.valueOf(o1.get("giftAccount")) +"\r\n");
sb.append("会员总余额:"+String.valueOf(o1.get("memberBalance")) +"\r\n");
sb.append("会员总积分:"+String.valueOf(o1.get("memberPoints")) +"\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("oilOrder"))+"</td>");
sb.append("<td>"+ String.valueOf(o1.get("receiptsMoney"))+"</td></tr>");
sb.append("<tr><td>充值总额</td>");
sb.append("<td>"+String.valueOf(o1.get("rechargeAll"))+"</td>");
sb.append("<td>"+ String.valueOf(o1.get("onAccount"))+"</td></tr>");
sb.append("<tr><td>合计</td>");
sb.append("<td>"+String.valueOf(o1.get("orderall"))+"</td>");
sb.append("<td>"+String.valueOf(o1.get("orderalls"))+"</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++){
sb.append("<tr><td>"+String.valueOf(o2.get(i).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o2.get(i).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o2.get(i).get("truePay"))+"</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("name"))+"</td>");
sb.append("<td>"+String.valueOf(o3.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o3.get(m).get("payAmount"))+"</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("discountStatistics");
for(int m=0;m<o4.size();m++){
sb.append("<tr><td>"+String.valueOf(o4.get(m).get("name"))+"</td>");
sb.append("<td>"+String.valueOf(o4.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o4.get(m).get("discountAmount"))+"</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("backMoneyStatistics");
for(int m=0;m<o5.size();m++){
sb.append("<tr><td>"+String.valueOf(o5.get(m).get("name"))+"</td>");
sb.append("<td>"+String.valueOf(o5.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o5.get(m).get("refMoney"))+"</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("billingDetails");
for(int m=0;m<o6.size();m++){
sb.append("<tr><td>"+String.valueOf(o6.get(m).get("name"))+"</td>");
sb.append("<td>"+String.valueOf(o6.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o6.get(m).get("amount"))+"</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("employeeStatistics");
for(int m=0;m<o7.size();m++){
sb.append("<tr><td>"+String.valueOf(o7.get(m).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o7.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o7.get(m).get("rechargeBalance"))+"</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("consumptionStatistics");
for(int m=0;m<o8.size();m++){
sb.append("<tr><td>"+String.valueOf(o8.get(m).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o8.get(m).get("orderNums"))+"</td>");
sb.append("<td>"+ String.valueOf(o8.get(m).get("orderNum"))+"</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("goodsNumberStatistics");
for(int m=0;m<o9.size();m++){
sb.append("<tr><td>"+String.valueOf(o9.get(m).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o9.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o9.get(m).get("payAmount"))+"</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("integerNumberStatistics");
for(int m=0;m<o10.size();m++){
sb.append("<tr><td>"+String.valueOf(o10.get(m).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o10.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o10.get(m).get("amount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------新增会员统计------</center>"+"\r\n");
Map<String,String> o11 = (Map<String,String>)handover.get("memberStatistics");
sb.append("<table><tr><td>新增会员数</td><td>"+ String.valueOf(o11.get("userNum"))+"</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("returnedToTheAccount");
for(int m=0;m<o12.size();m++){
sb.append("<tr><td>"+String.valueOf(o12.get(m).get("status"))+"</td>");
sb.append("<td>"+String.valueOf(o12.get(m).get("returnNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o12.get(m).get("amount"))+"</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("staffStatistics");
for(int m=0;m<o13.size();m++){
sb.append("<tr><td>"+String.valueOf(o13.get(m).get("name"))+"</td>");
sb.append("<td>"+String.valueOf(o13.get(m).get("staffNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o13.get(m).get("monye"))+"</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;
}
}