From 32d774dc27dfb9110f32b3749f40707adda7d3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Thu, 31 Oct 2024 15:58:43 +0800 Subject: [PATCH] 1 --- fuintAdmin/src/api/allOrder.js | 9 ++ .../reconciliation/tab/trading.vue | 81 +++++----- .../controller/AllOrderInfoController.java | 11 +- .../business/order/entity/AllOrderInfo.java | 3 +- .../order/mapper/AllOrderInfoMapper.java | 10 +- .../order/mapper/xml/AllOrderInfoMapper.xml | 153 ++++++++++++++++-- .../order/service/AllOrderInfoService.java | 2 + .../service/impl/AllOrderInfoServiceImpl.java | 53 +++++- .../order/vo/Excel/TradingOrderExcel.java | 44 +++++ 9 files changed, 306 insertions(+), 60 deletions(-) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/Excel/TradingOrderExcel.java diff --git a/fuintAdmin/src/api/allOrder.js b/fuintAdmin/src/api/allOrder.js index 465df14b1..a2c8bc782 100644 --- a/fuintAdmin/src/api/allOrder.js +++ b/fuintAdmin/src/api/allOrder.js @@ -224,3 +224,12 @@ export function getStaffByStorId() { }) } +//油站交易对账导出 +export function exportExcelOrderMsgsApi(data) { + return request({ + url: 'business/allOrderInfo/exportExcelOrderMsgApi', + method: 'post', + responseType: 'blob', // 表明响应类型为二进制流 + data: data // 通过 data 参数传递需要的数据 + }); +} diff --git a/fuintAdmin/src/views/financialStatement/reconciliation/tab/trading.vue b/fuintAdmin/src/views/financialStatement/reconciliation/tab/trading.vue index eac034f4f..9842e762f 100644 --- a/fuintAdmin/src/views/financialStatement/reconciliation/tab/trading.vue +++ b/fuintAdmin/src/views/financialStatement/reconciliation/tab/trading.vue @@ -15,7 +15,7 @@ - + @@ -104,31 +104,42 @@ - - - - 至 - - - + + + + + + + + + + + + + + + + + + + + + + + + 搜索 重置 - 导出 + 导出 @@ -324,9 +335,10 @@ import { exportExcelTradingApi, orderStatistics, transactionList, - getDicts + getDicts, + exportExcelOrderMsgsApi } from "@/api/allOrder"; -import {getStaffByStorId} from "../../../../api/allOrder"; +import {exportExcelOrderMsgApi, getStaffByStorId} from "../../../../api/allOrder"; export default { name: "reconciliation-trading", @@ -350,7 +362,7 @@ export default { // 收银台订单列表 orderList: [], deptList: [], - + dataRange:[], // 查询参数 queryParams: { page: 1, @@ -366,6 +378,7 @@ export default { deptId: "", userName:"", staffId:"", + dataRange:[], }, orderStatistics: { CASH: "0", @@ -405,12 +418,7 @@ export default { this.getStaffByStorId() }, exportExcelCashier() { - let dateRange = [] - if (this.beginTime && this.endTime) { - dateRange.push(this.beginTime.toLocaleDateString()) - dateRange.push(this.endTime.toLocaleDateString()) - } - exportExcelTradingApi(this.addDateRange(this.queryParams, dateRange)).then(res => { + exportExcelOrderMsgsApi(this.queryParams).then(res => { const blob = new Blob([res], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}); this.$download.saveAs(blob, '交易明细统计.xLsx') }) @@ -430,18 +438,17 @@ export default { // 获取数据列表 async getList(val) { - console.log(111111) let dateRange = [] if (this.beginTime && this.endTime) { - dateRange.push(this.beginTime.toLocaleDateString()) - dateRange.push(this.endTime.toLocaleDateString()) + dateRange.push(this.beginTime) + dateRange.push(this.endTime) } - transactionList(this.addDateRange(this.queryParams, dateRange)).then(response => { + console.log(this.beginTime) + transactionList(this.queryParams).then(response => { this.orderList = response.data.records; this.total = response.data.total; this.isSysDate = false this.getOrderStatistics() - }) }, diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/AllOrderInfoController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/AllOrderInfoController.java index 45221fcd6..09f99e10b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/AllOrderInfoController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/AllOrderInfoController.java @@ -427,11 +427,20 @@ public class AllOrderInfoController extends BaseController { /** * 查询这个油站的所有员工 * - * @param storeId + * @param * @return */ @PostMapping("getStaffByStorId") public ResponseObject getStaffByStorId(){ return getSuccessResult(allOrderInfoService.getStaffByStorId()); } + + /** + * 导出油站订单 + * @param response + */ + @PostMapping("exportExcelOrderMsgApi") + public void exportExcelOrderMsgApi(HttpServletResponse response, @RequestBody AllOrderInfoRes allOrderInfoRes) { + this.allOrderInfoService.exportExcelOrderMsgApi(response, allOrderInfoRes); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfo.java index 5bbe681a1..75ff9e362 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfo.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfo.java @@ -124,8 +124,9 @@ public class AllOrderInfo extends BaseEntity implements Serializable { private Long deptId; @TableField(exist = false) private List storeIds; - @TableField(exist = false) private String userName; + @TableField(exist = false) + private String[] dataRange; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java index f1d9822b6..134f032e5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java @@ -108,7 +108,11 @@ public interface AllOrderInfoMapper extends BaseMapper { Double getCountMemberBalance(@Param("storeId") Integer storeId,@Param("endTime") String endTime); AllOrderInfoVo selectByOrderNo(String orderNo); - IPage transactionList(Page page,@Param("obj") AllOrderInfoRes allOrderInfoRes); + IPage transactionList(Page page,@Param("obj") AllOrderInfoRes allOrderInfoRes, + @Param("beginTime") String beginTime,@Param("endTime") String endTime); - Map orderStatistics(@Param("obj") AllOrderInfoRes allOrderInfoRes); -} \ No newline at end of file + Map orderStatistics(@Param("obj") AllOrderInfoRes allOrderInfoRes,@Param("beginTime") String beginTime,@Param("endTime") String endTime); + + List transactionAllList(@Param("obj") AllOrderInfoRes allOrderInfoRes, + @Param("beginTime") String beginTime,@Param("endTime") String endTime); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml index 1df95d489..12109e4e7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml @@ -900,28 +900,153 @@ and ai.create_by = #{obj.staffId} + + = #{beginTime} ]]> + + + + ORDER BY ai.create_time DESC + - diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/AllOrderInfoService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/AllOrderInfoService.java index 50f031823..3bc78c7ba 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/AllOrderInfoService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/AllOrderInfoService.java @@ -206,4 +206,6 @@ AllOrderActivityVo getOneByOrderId(Integer orderId); Object cashierRefund(Map map) throws Exception; List getStaffByStorId(); + + void exportExcelOrderMsgApi(HttpServletResponse response, AllOrderInfoRes allOrderInfoRes); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java index c418d41c0..ed1ffac7a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java @@ -100,7 +100,8 @@ public class AllOrderInfoServiceImpl extends ServiceImpl orderStatistics(AllOrderInfoRes allOrderInfoRes) { - return allOrderInfoMapper.orderStatistics(allOrderInfoRes); + return allOrderInfoMapper.orderStatistics(allOrderInfoRes, allOrderInfoRes.getDataRange()==null?"":allOrderInfoRes.getDataRange()[0], + allOrderInfoRes.getDataRange()==null?"":allOrderInfoRes.getDataRange()[1]); } @Override @@ -808,7 +809,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl sysDepts = sysDeptMapper.selectChildrenDeptById2(new Page(1, 10000), nowAccountInfo.getDeptId(), allOrderInfo.getDeptId(), allOrderInfo.getDeptType()); + IPage sysDepts = sysDeptMapper.selectChildrenDeptById2(new Page(1, 10000), nowAccountInfo.getDeptId(), nowAccountInfo.getDeptId(), allOrderInfo.getDeptType()); if (ObjectUtil.isEmpty(sysDepts.getRecords())) { throw new RuntimeException("组织下没有油站!"); @@ -889,7 +890,9 @@ public class AllOrderInfoServiceImpl extends ServiceImpl allOrderInfoVoIPage = super.baseMapper.transactionList(page, allOrderInfoRes); + IPage allOrderInfoVoIPage = super.baseMapper.transactionList(page, allOrderInfoRes, + allOrderInfoRes.getDataRange()==null?"":allOrderInfoRes.getDataRange()[0], + allOrderInfoRes.getDataRange()==null?"":allOrderInfoRes.getDataRange()[1]); return allOrderInfoVoIPage; } @@ -897,7 +900,6 @@ public class AllOrderInfoServiceImpl extends ServiceImpl tradingPage = getTradingPage(new Page(1, 100000), order); List tradingExcel = new ArrayList<>(); for (AllOrderInfoVo record : tradingPage.getRecords()) { @@ -2424,4 +2426,47 @@ public class AllOrderInfoServiceImpl extends ServiceImpl mtStaffs= mtStaffMapper.getStaffByStorId(nowAccountInfo.getStoreId()); return mtStaffs; } + + + + @Override + public void exportExcelOrderMsgApi(HttpServletResponse response, AllOrderInfoRes allOrderInfoRes) { + List list= transactionAllList(allOrderInfoRes); + List tradingExcel = new ArrayList<>(); + for (TradingOrderExcel record : list) { + TradingOrderExcel excel = new TradingOrderExcel(); + 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(), TradingOrderExcel.class).sheet("download").doWrite(tradingExcel); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + /** + * 查询全部订单数据 + * @param + * @param allOrderInfoRes + * @return + */ + public List transactionAllList(AllOrderInfoRes allOrderInfoRes) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + allOrderInfoRes.setStoreId(nowAccountInfo.getStoreId()); + System.out.println(allOrderInfoRes.getDataRange()); + List allOrderInfoVo = super.baseMapper.transactionAllList(allOrderInfoRes, + allOrderInfoRes.getDataRange().length==0?"":allOrderInfoRes.getDataRange()[0], + allOrderInfoRes.getDataRange().length==0?"":allOrderInfoRes.getDataRange()[1]); + + return allOrderInfoVo; + } + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/Excel/TradingOrderExcel.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/Excel/TradingOrderExcel.java new file mode 100644 index 000000000..374adda87 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/Excel/TradingOrderExcel.java @@ -0,0 +1,44 @@ +package com.fuint.business.order.vo.Excel; + + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class TradingOrderExcel { + + @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 userName; // 付款用户 + @ExcelProperty("支付方式") + private String payType; // 支付方式 + @ExcelProperty("订单状态") + private String status; // 订单状态 + @ExcelProperty("支付渠道") + private String paymentChannel; // 支付渠道 + @ExcelProperty("商户号") + private String mchntCd; // 付款用户 + @ExcelProperty("收银员") + private String createBy; // 收银员 + @ExcelProperty("订单创建时间") + private Date createTime; // 支付时间 + @ExcelProperty("订单完成时间") + private Date updateTime; // 支付时间 +}