diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueRecordService.java index e363e9ec9..75f91dfa0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueRecordService.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.fuint.api.fuyou.entity.ReturnParameter; import com.fuint.business.integral.entity.IntegralDetail; +import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord; import com.fuint.business.marketingActivity.cardFule.vo.CardValueConditionVo; import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO; import com.fuint.business.marketingActivity.cardValue.dto.SelectCard; @@ -56,6 +57,8 @@ public interface CardValueRecordService extends IService { CardValueRecord checkTheStatusOfYourPayment(Integer id) throws Exception; + CardFuelRecord checkTheStatusOfYourPayments(Integer id) throws Exception; + boolean editPayStatus(@Param("id") Integer id,@Param("payStates") String payStates); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java index 9c02cd7a0..60474fe44 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java @@ -34,6 +34,8 @@ import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableS import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO; import com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO; import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel; +import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord; +import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelRecordMapper; import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService; import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService; import com.fuint.business.marketingActivity.cardFule.vo.CardValueConditionVo; @@ -53,6 +55,7 @@ import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrde import com.fuint.business.member.entity.LJStaff; import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.order.entity.*; +import com.fuint.business.order.mapper.AllOrderInfoMapper; import com.fuint.business.order.service.AllOrderInfoService; import com.fuint.business.order.service.CardBalanceChangeService; import com.fuint.business.order.service.GrowthValueChangeService; @@ -1443,5 +1446,105 @@ public class CardValueRecordServiceImpl extends ServiceImpl i order.setBalanceAmount(Double.valueOf(balanceAmount)); order.setOilCardAmount(Double.valueOf(oilCardAmount)); order.setActiveAmount(activeAmount); - order.setBalanceGiftAmount( this.countCardBalance(Double.valueOf(amount), userId, storeId, orderNo)); order.setStoreId(storeId); order.setUserId(userId); order.setStaffId(staffId); @@ -673,10 +672,15 @@ public class OilOrderServiceImpl extends ServiceImpl i if (payType.equals("card_value")) { // 修改用户储值卡余额 this.insertCardBalance(consumeAmount, userId, storeId, orderNo); + order.setBalanceGiftAmount( this.countCardBalance(Double.valueOf(amount), userId, storeId, orderNo)); } if (payType.equals("fule_card")) { // 修改用户囤油卡余额 userFuelService.changeBalance(userId, Integer.valueOf(jsonObject.get("oils").toString()), storeId, nowAccountInfo.getChainStoreId(), Double.valueOf(oilCardAmount), orderNo); + order.setOrderAmount(0.00); + order.setDiscountAmount(0.00); + order.setBalanceAmount(0.00); + order.setOilCardAmount(oilNum); } } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/controller/printerController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/controller/printerController.java index ebd03e4c5..c83763ddc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/controller/printerController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/controller/printerController.java @@ -361,7 +361,23 @@ public class printerController extends BaseController { // PrintFuelDieselReport.setHandover(fuelDiesel); // Integer random6 = (int) ((Math.random() * 9 + 1) * 100000); // String url=m.print("4004872261", PrintFuelDieselReport.printFeulOrder(), "Z"+System.currentTimeMillis()+random6.toString()); - printerService.printFuelDieselReport(fuelDiesel,TokenUtil.getNowAccountInfo().getStoreId()); + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + MtUser mtUser=null; + UserBalance userBalance=null; + LJUserGrade ljUserGrade=null; + String orderNo=null; + List> o = (List>)fuelDiesel.get("oilOrder"); + for (Map stringStringMap : o) { + orderNo=stringStringMap.get("orderNo"); + if("散客".equals(stringStringMap.get("payUser"))){ + }else { + mtUser=mtUserMapper.selectByPhone(stringStringMap.get("payUser")); + userBalance=userBalanceMapper.getUserBalanceByUserId(mtUser.getId().toString()); + ljUserGrade= ljUserGradeMapper.getUserGradeByUserId(userBalance.getGradeId().toString()); + } + } + ReceiptPrinting receiptPrinting = receiptPrintingService.queryReceiptPrintingOne(nowAccountInfo.getStoreId()); + printerService.printFuelDieselReport(fuelDiesel,TokenUtil.getNowAccountInfo().getStoreId(),receiptPrinting,mtUser,userBalance,ljUserGrade,orderNo); } @PostMapping("printIntegralReport") 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 f73ec5afc..8f6fbd138 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 @@ -32,7 +32,7 @@ public interface PrinterService { void printCardValueReport(Map printCardValue,Integer storeId, ReceiptPrinting receiptPrinting, MtUser mtUser, UserBalance userBalance, LJUserGrade ljUserGrade,String orderNo); - void printFuelDieselReport(Map printCardValue,Integer storeId); + void printFuelDieselReport(Map printCardValue,Integer storeId, ReceiptPrinting receiptPrinting, MtUser mtUser, UserBalance userBalance, LJUserGrade ljUserGrade,String orderNo); void printIntegralReport(Map integral, Integer storeId); 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 f9b023b12..73b0233d7 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 @@ -335,9 +335,10 @@ public class PrinterServiceImpl implements PrinterService { } } - public void printFuelDieselReport(Map fuelDiesel,Integer storeId) { + public void printFuelDieselReport(Map fuelDiesel,Integer storeId, ReceiptPrinting receiptPrinting, MtUser mtUser, UserBalance userBalance, LJUserGrade ljUserGrade,String orderNo) { PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId); - + // PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId); + AllOrderInfoVo allOrderInfoVo=allOrderInfoMapper.getOneByOrderNo(orderNo); log.info("handover:{}",fuelDiesel.toString()); Methods m=Methods.getInstance(); Object accessToken = RedisUtil.get("scancodemodel+" + storeId); @@ -354,7 +355,7 @@ public class PrinterServiceImpl implements PrinterService { m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret()); PrintFuelDieselReport.setHandover(fuelDiesel); Integer random6 = (int) ((Math.random() * 9 + 1) * 100000); - String url=m.print(infoByStoreId.getMachineCode(), PrintFuelDieselReport.printFeulOrder(), "Z"+System.currentTimeMillis()+random6.toString()); + String url=m.print(infoByStoreId.getMachineCode(), PrintFuelDieselReport.printFeulOrder(receiptPrinting,mtUser,userBalance,ljUserGrade,allOrderInfoVo), "Z"+System.currentTimeMillis()+random6.toString()); if (ObjectUtil.isNotEmpty(url)) { // 使用 Fastjson 将 JSON 字符串解析为 JSONObject JSONObject jsonObject = JSON.parseObject(url); @@ -362,7 +363,7 @@ public class PrinterServiceImpl implements PrinterService { String error = jsonObject.getString("error"); if ("18".equals(error)) { getToken(storeId); - printFuelDieselReport(fuelDiesel,storeId); + printFuelDieselReport(fuelDiesel,storeId, receiptPrinting, mtUser, userBalance, ljUserGrade, orderNo); } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintFuelDieselReport.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintFuelDieselReport.java index 4371bad89..a2ce89318 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintFuelDieselReport.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintFuelDieselReport.java @@ -1,31 +1,152 @@ package com.fuint.business.printer.template; import cn.hutool.core.util.ObjectUtil; +import com.fuint.business.order.vo.AllOrderInfoVo; +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.TokenUtil; +import com.fuint.repository.model.MtUser; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.HashMap; +import java.util.List; import java.util.Map; public class PrintFuelDieselReport { public static Map handover = new HashMap<>(); - public static String printFeulOrder() { - StringBuilder sb = new StringBuilder(); + public static String printFeulOrder(ReceiptPrinting receiptPrinting, MtUser mtUser, UserBalance userBalance, LJUserGrade ljUserGrade, + AllOrderInfoVo allOrderInfoVo) { +// 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("
订单统计\r\n
"); +// +// sb.append("打印时间:"+formattedDateTime +"\r\n"); +// sb.append("店铺名称:"+nowAccountInfo.getStoreName() +"\r\n"); +// sb.append("--------------------------------\r\n"); +// if (ObjectUtil.isNotEmpty(handover.get("oilType"))) { +// sb.append("充值油品:"+handover.get("oilType")+"\r\n"); +// sb.append("--------------------------------\r\n"); +// } +// if (ObjectUtil.isNotEmpty(handover.get("incomeLitres"))) { +// sb.append("充值升数:"+handover.get("incomeLitres")+"\r\n"); +// sb.append("--------------------------------\r\n"); +// } +// if (ObjectUtil.isNotEmpty(handover.get("realyPayBills"))) { +// sb.append("订单金额:¥"+handover.get("realyPayBills")+"\r\n"); +// sb.append("--------------------------------\r\n"); +// } +// if (ObjectUtil.isNotEmpty(handover.get("lockupPrice"))) { +// sb.append("锁价金额:¥"+handover.get("lockupPrice")+"\r\n"); +// sb.append("--------------------------------\r\n"); +// } +// if (ObjectUtil.isNotEmpty(handover.get("payType"))) { +// sb.append("支付方式:"+handover.get("payType")+"\r\n"); +// sb.append("--------------------------------\r\n"); +// } +// if (ObjectUtil.isNotEmpty(handover.get("realyPayBills"))) { +// sb.append("实付款:¥"+handover.get("realyPayBills")+"\r\n"); +// sb.append("--------------------------------\r\n"); +// } +// if (ObjectUtil.isNotEmpty(handover.get("seekZero"))) { +// sb.append("找零:¥"+handover.get("seekZero")+"\r\n"); +// sb.append("--------------------------------\r\n"); +// } +// +// sb.append("
谢谢惠顾,欢迎下次光临!
"); +// +// return sb.toString(); + + + + 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(); +// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + if(allOrderInfoVo.getPayChannel().equals("applet") && allOrderInfoVo.getContent().equals("油品订单")){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("zzzzz","一键加油")); + }else { + if(allOrderInfoVo.getContent().equals("收银台订单")){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("zzzzz","收银台消费")); + } + if(allOrderInfoVo.getContent().equals("储值卡充值")){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("zzzzz","会员充值")); + } + if(allOrderInfoVo.getContent().equals("囤油卡充值")){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("zzzzz","囤油卡充值")); + } + } + System.out.println( receiptPrinting.getPrintTemplateTop()); + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("xxxxx","32131566313655")); + if(mtUser!=null&&mtUser.getUserNo()!=null){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("kkkkk",mtUser.getUserNo())); + }else { + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("卡号:kkkkk\r\n","")); + } + if(mtUser!=null&&mtUser.getCarNo()!=null){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("ccccc",mtUser.getCarNo())); + }else { + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("车牌号:ccccc\r\n","")); + } + if(ljUserGrade!=null&&ljUserGrade.getName()!=null){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("ddddd",ljUserGrade.getName())); + }else { + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("等级:ddddd\r\n","")); + } + if(mtUser!=null&&mtUser.getMobile()!=null){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("sssss",mtUser.getMobile())); + }else { + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("手机号:sssss\r\n","")); + } + if(userBalance!=null&&userBalance.getCardBalance().toString()!=null){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("yyyyy",userBalance.getCardBalance().toString())); + }else { + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("余额:yyyyy\r\n","")); + } + if(userBalance!=null&&userBalance.getPoints().toString()!=null){ + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("jjjjj",userBalance.getPoints().toString())); + }else { + receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("积分:jjjjj\r\n","")); + } - sb.append("
订单统计\r\n
"); + if (allOrderInfoVo.getType().equals("1")) { + sb.append(""); + List> o = (List>)handover.get("oilOrder"); + for (Map stringStringMap : o) { + sb.append(""); + sb.append(""); + } + sb.append("
油品金额
"+stringStringMap.get("oilName")+"¥"+ stringStringMap.get("amount")+"
"); + sb.append("--------------------------------\r\n"); + + } + if (ObjectUtil.isNotEmpty(handover.get("goodsOrder"))) { + sb.append(""); + List> o = (List>)handover.get("goodsOrder"); + for (Map stringStringMap : o) { + sb.append(""); + sb.append(""); + + sb.append(""); + } + sb.append("
商品数量单价
"+stringStringMap.get("oilName")+""+stringStringMap.get("unit")+""+ stringStringMap.get("amount")+"
"); + sb.append("--------------------------------\r\n"); + + } - sb.append("打印时间:"+formattedDateTime +"\r\n"); - sb.append("店铺名称:"+nowAccountInfo.getStoreName() +"\r\n"); - sb.append("--------------------------------\r\n"); if (ObjectUtil.isNotEmpty(handover.get("oilType"))) { sb.append("充值油品:"+handover.get("oilType")+"\r\n"); sb.append("--------------------------------\r\n"); @@ -54,10 +175,10 @@ public class PrintFuelDieselReport { sb.append("找零:¥"+handover.get("seekZero")+"\r\n"); sb.append("--------------------------------\r\n"); } - - sb.append("
谢谢惠顾,欢迎下次光临!
"); - - return sb.toString(); + receiptPrinting.setPrintTemplateDown(receiptPrinting.getPrintTemplateDown(). + replace("ttttt",formattedDateTime)); + System.out.println(receiptPrinting.getPrintTemplateTop()+sb.toString()+receiptPrinting.getPrintTemplateDown()); + return receiptPrinting.getPrintTemplateTop()+sb.toString()+receiptPrinting.getPrintTemplateDown(); } public static Map getHandover() { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintOilOrderReport.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintOilOrderReport.java index 96dcf0c11..ca1ca3f9d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintOilOrderReport.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintOilOrderReport.java @@ -175,7 +175,10 @@ public class PrintOilOrderReport { sb.append("--------------------------------\r\n"); } - + if (ObjectUtil.isNotEmpty(handover.get("oilCardAmount"))) { + sb.append("加油升数:"+handover.get("oilCardAmount")+"L\r\n"); + sb.append("--------------------------------\r\n"); + } sb.append("支付方式:"+handover.get("payType")+"\r\n"); if ("credit".equals(handover.get("payType"))) { sb.append("挂账单位:"+handover.get("unitName")+"\r\n"); diff --git a/fuintCashierWeb/src/api/cashier/cardSet.js b/fuintCashierWeb/src/api/cashier/cardSet.js index 71e9729a1..aae2e43e9 100644 --- a/fuintCashierWeb/src/api/cashier/cardSet.js +++ b/fuintCashierWeb/src/api/cashier/cardSet.js @@ -54,6 +54,15 @@ export function getCheckTheStatusOfYourPaymentApi(query) { }) } +// 余额插入订单 +export function getCheckTheStatusOfYourPaymentApis(query) { + return request({ + url: 'business/marketingActivity/cardValueRecord/checkTheStatusOfYourPayments?id='+query, + method: 'get', + params: query + }) +} + // 根据字典类型查询字典数据信息 export function getDicts(dictType) { diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue index 7e59da2fc..a7ec81486 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue @@ -556,7 +556,7 @@ import {userListByPhone} from "@/api/cashier/user"; import {VueClipboard} from 'vue-clipboard2'; import {getDicts} from "@/api/dict/data"; import { - getCheckTheStatusOfYourPaymentApi, + getCheckTheStatusOfYourPaymentApis, rechargeCard } from "@/api/cashier/cardSet"; import {getReturnCode, printOilOrderReport,printCardValueReport,printFuelDieselReport} from '../../../api/print' @@ -569,6 +569,7 @@ export default { data() { return { orderNo:'', + oilCardAmount:'', disOil: 0.00, disGoods: 0.00, loadingPreferential: false, @@ -1051,7 +1052,7 @@ export default { // let timer = setInterval(async () => { let flag = false - await getCheckTheStatusOfYourPaymentApi(id).then(async response => { + await getCheckTheStatusOfYourPaymentApis(id).then(async response => { if (response.data != null) { const payStatus = response.data.payStatus this_.orderNo=response.data.paymentNo @@ -1204,6 +1205,8 @@ export default { consumeAmount: this.realAmount, // 屯油卡付款 consumeRefuelMoney: this.realAmount, + //多少升油 + oilCardAmount:this.oilCardAmount, // 实付款 actualPay: this.realAmount, // 找零 @@ -1260,7 +1263,13 @@ export default { if (this.payForm.cardType==1){ let payTypeText1 = payTypeMap[this.payForm.paymentType] console.log(this.payForm,1256) + let mm=[] + mm.push({ + orderNo:this.orderNo, + payUser:this.chooseVipUser.mobile + }) let b = { + oilOrder:mm, // 充值油品 oilType:this.payForm.oilName, // 充值升数 @@ -1445,6 +1454,7 @@ export default { await addLJGoods(_this.payForm).then(async response => { _this.orderNo = response.data.orderNo; this.orderNo = response.data.orderNo; + _this.oilCardAmount = response.data.oilOrder.oilCardAmount //支付成功 后需要打印小票 console.log("支付成功", response) @@ -2089,7 +2099,6 @@ export default { //支付弹窗 相关 this.payForm.realyPayBills = this.realAmount await addLJGoods(this.payForm).then(response => { - }) }, /**