diff --git a/fuintAdmin/src/api/handover/handover.js b/fuintAdmin/src/api/handover/handover.js index 05f0ec606..738955ae2 100644 --- a/fuintAdmin/src/api/handover/handover.js +++ b/fuintAdmin/src/api/handover/handover.js @@ -44,3 +44,10 @@ export function printLocallyApi(data) { data: data }) } +export function handoverShiftPrintingReceipts(data) { + return request({ + url: '/business/handoverRecord/handoverShiftPrintingReceipts', + method: 'post', + data: data + }) +} diff --git a/fuintAdmin/src/views/handover/HandoverDetails.vue b/fuintAdmin/src/views/handover/HandoverDetails.vue index 7a7a4920e..0b20d56a3 100644 --- a/fuintAdmin/src/views/handover/HandoverDetails.vue +++ b/fuintAdmin/src/views/handover/HandoverDetails.vue @@ -40,7 +40,7 @@
门店交接单
- 打印 + 打印
油站名称
@@ -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, 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 70b020c5c..6cdd1749c 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 @@ -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 map = allOrderInfoService.findOrderStatistics(allOrderInfoRes); - return getSuccessResult(map); - } - - @PostMapping("/exportExcelHandoverOrder") - public void exportExcelHandoverOrder(HttpServletResponse response, @RequestBody AllOrderInfoRes allOrderInfoRes) { - allOrderInfoService.exportExcelHandoverOrder(response, allOrderInfoRes); - } - /** * 机构流水分析 */ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HandoverRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HandoverRecordController.java index 0fcff4cb9..bb89ddf35 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HandoverRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HandoverRecordController.java @@ -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 handAll=handoverRecordService.handover3(staffId); + printerService.handoverShiftPrintingReceipt(handAll); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/dto/AllOrderInfoRes.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/dto/AllOrderInfoRes.java index d0b88a4f0..e69de29bb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/dto/AllOrderInfoRes.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/dto/AllOrderInfoRes.java @@ -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; -} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfoRes.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfoRes.java new file mode 100644 index 000000000..43553cdaf --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfoRes.java @@ -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 fenxiByDaili2; + @TableField(exist = false) + 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 9461294cb..6fc054cb0 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 @@ -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 { Double getCountMemberBalance(@Param("storeId") Integer storeId,@Param("endTime") String endTime); AllOrderInfoVo selectByOrderNo(String orderNo); - - Map 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 transactionList(Page page,@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/HandoverRecordMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/HandoverRecordMapper.java index 3c47b00eb..6664d7b9d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/HandoverRecordMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/HandoverRecordMapper.java @@ -111,5 +111,28 @@ public interface HandoverRecordMapper { List> returnedToTheAccount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId); + // 所有订单统计 + Map oilOrderStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + + List> paymentAggregation1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + + List> oilNumberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + + List> discountStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + + List> backMoneyStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + + List> billingDetails1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId); + + List> employeeStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + List> consumptionStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + List> goodsNumberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + List> IntegerNumberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + + List> memberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId); + + List> returnedToTheAccount1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId); + List> staffStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId); + } 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 0395f3cb5..ec9d361ea 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 @@ -852,142 +852,6 @@ from all_order_info where order_no = #{orderNo} - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 ba9704c6a..a994a4052 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 @@ -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 orderStatistics(AllOrderInfoRes allOrderInfoRes); - Map findOrderStatistics(AllOrderInfoRes allOrderInfoRes); - - void exportExcelHandoverOrder(HttpServletResponse response, AllOrderInfoRes allOrderInfoRes); - /** * 分页查询全部订单信息 * @param allOrderInfo diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java index e91a7af86..d025d0a64 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java @@ -67,5 +67,6 @@ public interface HandoverRecordService { public void printLocally(Map aa); + public Map handover3(Integer staffId); } 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 10ca192a0..418c26d29 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 @@ -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 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 list = getAllOrderInfo(allOrderInfoRes); - List 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 getPageList(Page page, AllOrderInfo allOrderInfo) { IPage pageList = allOrderInfoMapper.getPageList(page, allOrderInfo); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java index aaeeb2d33..70291fe04 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java @@ -367,20 +367,14 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { // 普通收款(订单) 普通收款(退款) 普通收款(实收) Map goodsOrderStatistics = handoverRecordMapper.goodsOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId); - - // 会员总积分 Map stringObjectMap = userBalanceMapper.selectHoverBalance(); - // 新增会员统计 Map stringObjectMap1 = userBalanceMapper.addNumberSum(); - // 优惠金额 // 会员消费 // 实收 Map 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 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 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 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 orderSummaryMap = orderSummary1(startTime, formattedEndTime, staffId); + handoverMap.put("orderSummary",orderSummaryMap); + // 支付方式汇总 + List> paymentAggregationMap = paymentAggregation1(startTime, formattedEndTime, staffId); + handoverMap.put("paymentAggregation",paymentAggregationMap); + // 油号统计 + List> oilNumberStatisticsMap = oilNumberStatistics(startTime, formattedEndTime, staffId); + handoverMap.put("oilNumberStatistics",oilNumberStatisticsMap); + // 优惠统计 + List> discountStatisticsMap = discountStatistics(startTime, formattedEndTime, staffId); + handoverMap.put("discountStatistics",discountStatisticsMap); + // 退款统计 + List> backMoneyStatisticsMap = backMoneyStatistics(startTime, formattedEndTime, staffId); + handoverMap.put("backMoneyStatistics",backMoneyStatisticsMap); + // 挂账统计 + List> billingDetailsMap = billingDetails1(startTime, formattedEndTime, staffId); + handoverMap.put("billingDetails",billingDetailsMap); + // 会员充值记录 + List> employeeStatisticsMap = employeeStatistics1(startTime, formattedEndTime, staffId); + handoverMap.put("employeeStatistics",employeeStatisticsMap); + // 会员消费统计 + List> consumptionStatisticsMap = consumptionStatistics(startTime, formattedEndTime, staffId); + handoverMap.put("consumptionStatistics",consumptionStatisticsMap); + // 便利店交易信息 + List> goodsNumberStatistics = goodsNumberStatistics1(startTime, formattedEndTime, staffId); + handoverMap.put("goodsNumberStatistics",goodsNumberStatistics); + // 积分商城兑换信息 + List> IntegerNumberStatistics = IntegerNumberStatistics1(startTime, formattedEndTime, staffId); + handoverMap.put("IntegerNumberStatistics",IntegerNumberStatistics); + // 会员新增统计 + List> memberStatisticsMap = memberStatistics1(startTime, formattedEndTime, staffId); + handoverMap.put("memberStatistics",memberStatisticsMap); + // 挂账归还 + List> returnedToTheAccountMap = returnedToTheAccount1(startTime, formattedEndTime, staffId) ; + handoverMap.put("returnedToTheAccount",returnedToTheAccountMap); + + // 员工统计 + List> staffStatisticsMap = staffStatistics(startTime, formattedEndTime, staffId); + handoverMap.put("staffStatistics",staffStatisticsMap); + + + + // huiyuan支付方式汇总 +// List> paymentAggregationMap = paymentAggregationByhuiyuan(startTime, formattedEndTime, staffId); +// handoverMap.put("paymentAggregation",paymentAggregationMap); + // 合计 + return handoverMap; + } + + + + public Map orderSummary1(String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Map allStatistics = new HashMap<>(); + Map 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> paymentAggregation1(String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> paymentAggregation = handoverRecordMapper.paymentAggregation1(startTime, endTime, nowAccountInfo.getStoreId(),staffId); + return paymentAggregation; + } + /** + * 油号统计 + */ + public List> oilNumberStatistics1 (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> oilNumberStatistics = handoverRecordMapper.oilNumberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return oilNumberStatistics; + } + /** + * 优惠统计 + */ + public List> discountStatistics (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> oilNumberStatistics = handoverRecordMapper.discountStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return oilNumberStatistics; + } + /** + * 退款统计 + */ + public List> backMoneyStatistics (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> oilNumberStatistics = handoverRecordMapper.backMoneyStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return oilNumberStatistics; + } + + /** + * 挂账统计 + * @param startTime + * @param endTime + * @param staffId + * @return + */ + public List> billingDetails1 (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> billingDetails = handoverRecordMapper.billingDetails1(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return billingDetails; + } + /** + * 会员卡充值统计 + * @param startTime + * @param endTime + * @param staffId + * @return + */ + public List> employeeStatistics1 (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> billingDetails = handoverRecordMapper.employeeStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return billingDetails; + } + /** + * 会员卡消费统计 + * @param startTime + * @param endTime + * @param staffId + * @return + */ + public List> consumptionStatistics (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> billingDetails = handoverRecordMapper.consumptionStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return billingDetails; + } + + /** + * 便利店统计 + * @param startTime + * @param endTime + * @param staffId + * @return + */ + public List> goodsNumberStatistics1 (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> oilNumberStatistics = handoverRecordMapper.goodsNumberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return oilNumberStatistics; + } + + /** + * 积分商城统计 + * @param startTime + * @param endTime + * @param staffId + * @return + */ + public List> IntegerNumberStatistics1 (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> oilNumberStatistics = handoverRecordMapper.IntegerNumberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return oilNumberStatistics; + } + /** + * 会员新增统计 + * @param startTime + * @param endTime + * @param staffId + * @return + */ + public List> memberStatistics1 (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> oilNumberStatistics = handoverRecordMapper.memberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return oilNumberStatistics; + } + + /** + * 挂账归还 + * @param startTime + * @param endTime + * @param staffId + * @return + */ + public List> returnedToTheAccount1 (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> returnedToTheAccount = handoverRecordMapper.returnedToTheAccount1(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return returnedToTheAccount; + } + /** + * 挂账归还 + * @param startTime + * @param endTime + * @param staffId + * @return + */ + public List> staffStatistics (String startTime, String endTime, Integer staffId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> returnedToTheAccount = handoverRecordMapper.staffStatistics(startTime, endTime, nowAccountInfo.getStoreId(), staffId); + return returnedToTheAccount; + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/Excel/HandoverOrderExcel.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/Excel/HandoverOrderExcel.java deleted file mode 100644 index 2a3a22671..000000000 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/Excel/HandoverOrderExcel.java +++ /dev/null @@ -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; // 支付时间 -} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/PrinterService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/PrinterService.java index 79209d9e3..f73ec5afc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/PrinterService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/PrinterService.java @@ -36,5 +36,5 @@ public interface PrinterService { void printIntegralReport(Map integral, Integer storeId); - + void handoverShiftPrintingReceipt(Map handAll); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/impl/PrinterServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/impl/PrinterServiceImpl.java index 6a8193677..f9b023b12 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/impl/PrinterServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/impl/PrinterServiceImpl.java @@ -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 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()); + } + + } + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/HandoverShiftPrintingReceipt.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/HandoverShiftPrintingReceipt.java new file mode 100644 index 000000000..da1ad502f --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/HandoverShiftPrintingReceipt.java @@ -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 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("0"); + sb.append("
门店交接单
"+"\r\n"); + Map o = (Map)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 o1 = (Map)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("
---------------------------
"+"\r\n"); + sb.append("
------营业收入统计------
"+"\r\n"); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append("
类型订单金额实收金额
营业总额"+String.valueOf(o1.get("allyingye1"))+""+ String.valueOf(o1.get("allyingye"))+"
充值总额"+String.valueOf(o1.get("allchuzhika1"))+""+ String.valueOf(o1.get("allchuzhika"))+"
合计"+String.valueOf(o1.get("allyingye1"))+""+String.valueOf(o1.get("allchuzhika1"))+"
"); + sb.append("
------支付方式统计------
"+"\r\n"); + sb.append(""); + List> o2 = (List>)handover.get("paymentAggregation"); + for(int i=0;i"); + }else if("WECHAT".equals(o2.get(i).get("payType"))){ + sb.append(""); + }else if("UNIONPAY".equals(o2.get(i).get("payType"))){ + sb.append(""); + }else if("CASH".equals(o2.get(i).get("payType"))){ + sb.append(""); + }else if("balance".equals(o2.get(i).get("payType"))){ + sb.append(""); + }else if("card_value".equals(o2.get(i).get("payType"))){ + sb.append(""); + }else { + sb.append(""); + } + sb.append(""); + sb.append(""); + } + sb.append("
支付方式笔数实收金额
支付宝
微信
银联二维码
现金
余额
油卡
其余"+String.valueOf(o2.get(i).get("numberOfDeals"))+""+ String.valueOf(o2.get(i).get("paidAmount"))+"
"); + sb.append("
------油品实收统计------
"+"\r\n"); + sb.append(""); + List> o3 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
油号笔数实收金额
"+String.valueOf(o3.get(m).get("oilName"))+""+String.valueOf(o3.get(m).get("numberOfDeals"))+""+ String.valueOf(o3.get(m).get("paidAmount"))+"
"); + sb.append("
------优惠统计------
"+"\r\n"); + sb.append(""); + List> o4 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
油号笔数实收金额
"+String.valueOf(o4.get(m).get("oilName"))+""+String.valueOf(o4.get(m).get("numberOfDeals"))+""+ String.valueOf(o4.get(m).get("paidAmount"))+"
"); + sb.append("
------退款统计------
"+"\r\n"); + sb.append(""); + List> o5 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
油号笔数实收金额
"+String.valueOf(o5.get(m).get("oilName"))+""+String.valueOf(o5.get(m).get("numberOfDeals"))+""+ String.valueOf(o5.get(m).get("paidAmount"))+"
"); + sb.append("
------挂账统计------
"+"\r\n"); + sb.append(""); + List> o6 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
关账单位笔数实收金额
"+String.valueOf(o6.get(m).get("oilName"))+""+String.valueOf(o6.get(m).get("numberOfDeals"))+""+ String.valueOf(o6.get(m).get("paidAmount"))+"
"); + sb.append("
------会员充值统计------
"+"\r\n"); + sb.append(""); + List> o7 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
支付放松笔数实收金额
"+String.valueOf(o7.get(m).get("oilName"))+""+String.valueOf(o7.get(m).get("numberOfDeals"))+""+ String.valueOf(o7.get(m).get("paidAmount"))+"
"); + sb.append("
------会员消费统计------
"+"\r\n"); + sb.append(""); + List> o8 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
支付放松笔数实收金额
"+String.valueOf(o8.get(m).get("oilName"))+""+String.valueOf(o8.get(m).get("numberOfDeals"))+""+ String.valueOf(o8.get(m).get("paidAmount"))+"
"); + sb.append("
------便利店统计------
"+"\r\n"); + sb.append(""); + List> o9 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
支付放松笔数实收金额
"+String.valueOf(o9.get(m).get("oilName"))+""+String.valueOf(o9.get(m).get("numberOfDeals"))+""+ String.valueOf(o9.get(m).get("paidAmount"))+"
"); + sb.append("
------积分商城统计------
"+"\r\n"); + sb.append(""); + List> o10 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
支付方式笔数实收金额
"+String.valueOf(o10.get(m).get("oilName"))+""+String.valueOf(o10.get(m).get("numberOfDeals"))+""+ String.valueOf(o10.get(m).get("paidAmount"))+"
"); + sb.append("
------新增会员统计------
"+"\r\n"); + sb.append(""); + List> o11 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + } + sb.append("
新增会员数实收金额
"+String.valueOf(o11.get(m).get("oilName"))+""+ String.valueOf(o11.get(m).get("paidAmount"))+"
"); + sb.append("
------挂账会换统计(在处理)------
"+"\r\n"); + sb.append(""); + List> o12 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
支付放松笔数实收金额
"+String.valueOf(o12.get(m).get("oilName"))+""+String.valueOf(o12.get(m).get("numberOfDeals"))+""+ String.valueOf(o12.get(m).get("paidAmount"))+"
"); + sb.append("
------员工实收统计------
"+"\r\n"); + sb.append(""); + List> o13 = (List>)handover.get("oilNumberStatistics"); + for(int m=0;m"); + sb.append(""); + sb.append(""); + } + sb.append("
支付放松笔数实收金额
"+String.valueOf(o13.get(m).get("oilName"))+""+String.valueOf(o13.get(m).get("numberOfDeals"))+""+ String.valueOf(o13.get(m).get("paidAmount"))+"
"); + sb.append("--------------------------------\r\n"); + return sb.toString(); + } + + public static Map getHandover() { + return handover; + } + public static void setHandover(Map handover) { + HandoverShiftPrintingReceipt.handover = handover; + } +}