From 3f243f5c637acca745c09e689d9b0feec6e7eda6 Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Mon, 15 Jan 2024 14:00:24 +0800 Subject: [PATCH 1/6] bug --- .../api/fuyou/controller/FyPayController.java | 11 +- .../CardBalanceChangeController.java | 2 +- .../impl/CardBalanceChangeServiceImpl.java | 15 +- .../service/impl/OilOrderServiceImpl.java | 360 ++++++++---- .../src/api/cashier/balancecardrecord.js | 35 ++ .../views/cashier/NewComponents/homeindex.vue | 6 +- .../cashier/vipComponents/balanceList.vue | 517 ++++++++++-------- 7 files changed, 609 insertions(+), 337 deletions(-) create mode 100644 fuintCashierWeb/src/api/cashier/balancecardrecord.js diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java index 7c62582d7..e8b774665 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java @@ -1,10 +1,12 @@ package com.fuint.api.fuyou.controller; import cn.hutool.core.util.ObjectUtil; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fuint.api.fuyou.entity.Const; import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.util.Utils; import com.fuint.business.integral.service.IntegralOrdersService; +import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService; import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService; import com.fuint.business.order.entity.AllOrderInfo; import com.fuint.business.order.entity.OilOrder; @@ -37,13 +39,16 @@ public class FyPayController { private CardValueRecordService cardValueRecordService; @Autowired @Lazy + private CardFuelRecordService cardFuelRecordService; + @Autowired + @Lazy private AllOrderInfoService allOrderInfoService; @Autowired private RedisLock redisLock; // 接收支付平台异步通知的接口 @PostMapping("/notify") - public String notifyUrl(HttpServletRequest request,HttpServletResponse response) throws UnsupportedEncodingException { + public String notifyUrl(HttpServletRequest request,HttpServletResponse response) throws UnsupportedEncodingException, JsonProcessingException { System.out.println("----------------收到支付回调--------"+request.getParameter("req")); String notifyData = request.getParameter("req"); String decode = URLDecoder.decode(notifyData, Const.charset); @@ -74,7 +79,7 @@ public class FyPayController { return "0"; } } - public void updateOrderStatus(String orderNo,String type){ + public void updateOrderStatus(String orderNo,String type) throws JsonProcessingException { if ("1".equals(type)) { orderService.updateOrderStatus(orderNo,"paid"); }else if ("4".equals(type)) { @@ -83,6 +88,8 @@ public class FyPayController { }else if ("3".equals(type)){ cardValueRecordService.rechargeFinallDeal(orderNo); + }else if ("5".equals(type)){ + cardFuelRecordService.fuleRechargeFinallDeal(orderNo); } } } \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CardBalanceChangeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CardBalanceChangeController.java index 67eee562c..05f3dd7a0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CardBalanceChangeController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CardBalanceChangeController.java @@ -75,7 +75,7 @@ public class CardBalanceChangeController extends BaseController { stroeBalanceCountVO.setOutCount(collectOut.size()); //充值笔数 List collectIn = records.stream().filter(s -> s.getChangeType().equals("1")).collect(Collectors.toList()); - stroeBalanceCountVO.setOutCount(collectIn.size()); + stroeBalanceCountVO.setInCount(collectIn.size()); //消费总额 double totalConsumption = 0.0; for (CardBalanceChange cardBalanceChange1 : collectOut) { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CardBalanceChangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CardBalanceChangeServiceImpl.java index 37359f057..a34a72d4a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CardBalanceChangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CardBalanceChangeServiceImpl.java @@ -9,19 +9,28 @@ import com.fuint.business.order.entity.CashierOrder; import com.fuint.business.order.mapper.CardBalanceChangeMapper; import com.fuint.business.order.service.CardBalanceChangeService; import com.fuint.business.order.vo.CardBalanceChangeVo; +import com.fuint.business.storeInformation.entity.LJStore; +import com.fuint.business.storeInformation.service.ILJStoreService; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class CardBalanceChangeServiceImpl extends ServiceImpl implements CardBalanceChangeService { + @Autowired + private ILJStoreService storeService; + @Override public int insertCardBalance(CardBalanceChange cardBalanceChange) { - AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); - Integer storeId = nowAccountInfo.getStoreId(); - cardBalanceChange.setStoreId(storeId); + if (cardBalanceChange.getStoreId()==null){ + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + cardBalanceChange.setStoreId(nowAccountInfo.getStoreId()); + } + LJStore store = storeService.selectStoreByStoreId(cardBalanceChange.getStoreId()); + cardBalanceChange.setChainStoreId(store.getChainStoreId()); int row = baseMapper.insert(cardBalanceChange); return row; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index 7def83026..62275c395 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -80,8 +80,12 @@ public class OilOrderServiceImpl extends ServiceImpl i @Autowired private OilNameService oilNameService; @Autowired + private OilNumberService oilNumberService; + @Autowired private CardBalanceChangeService cardBalanceChangeService; @Autowired + private OilBalanceChangeService oilBalanceChangeService; + @Autowired private OilConfigService oilConfigService; @Autowired private LJGoodsService goodsService; @@ -206,11 +210,16 @@ public class OilOrderServiceImpl extends ServiceImpl i // 会员消费金额(储值卡需要减少的金额) Double consumeAmount = Double.valueOf(map.get("consumeAmount")); Integer userId = null; +// 根据日期生成订单信息 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String timestamp = dateFormat.format(new Date()); + String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6); + String orderNo = "2345"+timestamp+randomString; if (map.get("userId") != null && !map.get("userId").equals("")){ // 会员id userId = Integer.valueOf(map.get("userId")); - this.insertCardBalance(consumeAmount,userId,storeId); + this.insertCardBalance(consumeAmount,userId,storeId,orderNo); } // 优惠券id Integer couponId = null; @@ -234,11 +243,6 @@ public class OilOrderServiceImpl extends ServiceImpl i payStatus = "unpaid"; } -// 根据日期生成订单信息 - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); - String timestamp = dateFormat.format(new Date()); - String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6); - String orderNo = "2345"+timestamp+randomString; Map orders = new HashMap<>(); @@ -477,64 +481,8 @@ public class OilOrderServiceImpl extends ServiceImpl i Double cardBalance = balance.getCardBalance(); JSONArray refuelMoneys = JSONArray.parseArray(balance.getRefuelMoney()); - if (cardBalance >= oilAmount) { - // 添加油品订单信息 - OilOrder order = new OilOrder(); - for (int i = 0;i < oilOrders.size();i++) { - Double amount = Double.valueOf(oilOrders.get(i).get("amount").toString()); - Double oilPrice = Double.valueOf(oilOrders.get(i).get("oilPrice").toString()); - Double oilNum = amount / oilPrice; - if (i == 0) { - order.setOrderType("主订单"); - order.setOrderAmount(amount); - order.setPayAmount(0.0); - order.setOrderNo(orderNo); - } else { - order.setOrderType("子订单"); - order.setOrderAmount(amount); - order.setPayAmount(0.0); - order.setOrderNo(orderNo + "1"); - } - order.setStoreId(accountInfo.getStoreId()); - order.setUserId(userId); - order.setCommissionAmount(Double.valueOf(map.get("commissionAmount"))); - order.setStaffId(Integer.valueOf(map.get("staffId"))); - order.setTerminal(map.get("terminal")); - order.setOils((String) oilOrders.get(i).get("oilName")); - order.setOilGunNum(oilOrders.get(i).get("gunName").toString()); - order.setOilNum(oilNum); -// order.setDiscountAmount(Double.valueOf(map.get("oilDiscount"))); - order.setPayUser(userVo1.getMobile()); - order.setPayType(map.get("payType")); - order.setInvoicing("未开票"); - order.setOrderStatus("paid"); - order.setPayTime(new Date()); +// if (cardBalance < oilAmount) { - this.addOilTrack(oilOrders.get(i), accountInfo.getStoreId()); - baseMapper.insert(order); - } - OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo); - -// 添加收银台订单信息 - CashierOrder cashierOrder = new CashierOrder(); - cashierOrder.setStaffId(Integer.valueOf(map.get("staffId"))); - cashierOrder.setStoreId(accountInfo.getStoreId()); - cashierOrder.setPayUser(userVo1.getMobile()); - cashierOrder.setAmount(oilAmount); - cashierOrder.setPayAmount(oilAmount); - cashierOrder.setStatus("paid"); - cashierOrder.setPayTime(new Date()); - cashierOrder.setOrderNo(orderNo); - cashierOrder.setOilOrderAmount(oilAmount); -// cashierOrder.setOilDiscountAmount(Double.valueOf(map.get("oilDiscount"))); - cashierOrder.setTerminal(map.get("terminal")); - cashierOrder.setOilOrderId(oilOrder.getId()); - cashierOrderService.insertCashierOrder(cashierOrder); - this.updateGrowthValue1(oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId); - this.insertAllOrderInfo(orderNo,accountInfo.getStoreId(),oilAmount,map.get("payType"),userId,"PC","1","paid"); - - res.put("success","success"); - } else { String status = "unpaid"; if (ObjectUtil.isNotEmpty(refuelMoneys)){ @@ -552,11 +500,11 @@ public class OilOrderServiceImpl extends ServiceImpl i boolean flag = false; for (int i = 0;i < oilOrders.size();i++) { if (oilOrders.get(i).get("oilName").equals(oilName.getId().toString())){ + Double amount = Double.valueOf(oilOrders.get(i).get("amount").toString()); + Double oilPrice = Double.valueOf(oilOrders.get(i).get("oilPrice").toString()); if (refuelMoneyLiters>=Double.valueOf(oilOrders.get(i).get("liters").toString())) { - status = "paid"; flag = true; - Double amount = Double.valueOf(oilOrders.get(i).get("amount").toString()); - Double oilPrice = Double.valueOf(oilOrders.get(i).get("oilPrice").toString()); + status = "paid"; Double oilNum = amount / oilPrice; if (i == 0) { order.setOrderType("主订单"); @@ -588,37 +536,228 @@ public class OilOrderServiceImpl extends ServiceImpl i baseMapper.insert(order); oilOrder = this.selectOilOrderByOrderNo(orderNo); - cashierOrder.setStaffId(Integer.valueOf(map.get("staffId"))); - cashierOrder.setStoreId(accountInfo.getStoreId()); - cashierOrder.setPayUser(userVo1.getMobile()); - cashierOrder.setAmount(oilAmount); - cashierOrder.setPayAmount(oilAmount); - cashierOrder.setStatus(status); - cashierOrder.setPayTime(new Date()); - cashierOrder.setOrderNo(orderNo); - cashierOrder.setOilOrderAmount(oilAmount); -// cashierOrder.setOilDiscountAmount(Double.valueOf(map.get("oilDiscount"))); - cashierOrder.setTerminal(map.get("terminal")); - cashierOrder.setOilOrderId(oilOrder.getId()); - this.updateGrowthValue1(0.0, userId, Integer.valueOf(oilOrder.getOils()), refuelMoneyLiters - Double.valueOf(oilOrders.get(i).get("liters").toString()), storeId); - this.insertAllOrderInfo(orderNo, storeId, oilAmount, map.get("payType"), userId, "PC", "1", status); + this.updateGrowthValue1(0.0, userId, Integer.valueOf(oilOrder.getOils()), refuelMoneyLiters - Double.valueOf(oilOrders.get(i).get("liters").toString()), storeId,orderNo); + this.insertOilBalance(userId,storeId,oilName.getId().toString(),oilName.getOilType(),Double.valueOf(oilOrders.get(i).get("liters").toString()),refuelMoneyLiters - Double.valueOf(oilOrders.get(i).get("liters").toString()),orderNo); + }else if (refuelMoneyLiters>0 && (Double.valueOf(oilOrders.get(i).get("liters").toString())-refuelMoneyLiters)*oilPrice<=cardBalance){ + flag = true; + status = "paid"; + Double oilNum = amount / oilPrice; + if (i == 0) { + order.setOrderType("主订单"); + order.setOrderAmount(amount); + order.setPayAmount(0.0); + order.setOrderNo(orderNo); + } else { + order.setOrderType("子订单"); + order.setOrderAmount(amount); + order.setPayAmount(0.0); + order.setOrderNo(orderNo + "1"); + } + order.setStoreId(accountInfo.getStoreId()); + order.setUserId(userId); + order.setCommissionAmount(Double.valueOf(map.get("commissionAmount"))); + order.setStaffId(Integer.valueOf(map.get("staffId"))); + order.setTerminal(map.get("terminal")); + order.setOils((String) oilOrders.get(i).get("oilName")); + order.setOilGunNum(oilOrders.get(i).get("gunName").toString()); + order.setOilNum(oilNum); +// order.setDiscountAmount(Double.valueOf(map.get("oilDiscount"))); + order.setPayUser(userVo1.getMobile()); + order.setPayType(map.get("payType")); + order.setInvoicing("未开票"); + order.setOrderStatus(status); + order.setPayTime(new Date()); + + this.addOilTrack(oilOrders.get(i), accountInfo.getStoreId()); + baseMapper.insert(order); + + oilOrder = this.selectOilOrderByOrderNo(orderNo); + this.updateGrowthValue1((Double.valueOf(oilOrders.get(i).get("liters").toString())-refuelMoneyLiters)*oilPrice, userId, Integer.valueOf(oilOrder.getOils()), 0.0, storeId,orderNo); + this.insertOilBalance(userId,storeId,oilName.getId().toString(),oilName.getOilType(),refuelMoneyLiters,0.0,orderNo); + } else if (cardBalance >= oilAmount){ + flag = true; + status = "paid"; + Double oilNum = amount / oilPrice; + if (i == 0) { + order.setOrderType("主订单"); + order.setOrderAmount(amount); + order.setPayAmount(0.0); + order.setOrderNo(orderNo); + } else { + order.setOrderType("子订单"); + order.setOrderAmount(amount); + order.setPayAmount(0.0); + order.setOrderNo(orderNo + "1"); + } + order.setStoreId(accountInfo.getStoreId()); + order.setUserId(userId); + order.setCommissionAmount(Double.valueOf(map.get("commissionAmount"))); + order.setStaffId(Integer.valueOf(map.get("staffId"))); + order.setTerminal(map.get("terminal")); + order.setOils((String) oilOrders.get(i).get("oilName")); + order.setOilGunNum(oilOrders.get(i).get("gunName").toString()); + order.setOilNum(oilNum); +// order.setDiscountAmount(Double.valueOf(map.get("oilDiscount"))); + order.setPayUser(userVo1.getMobile()); + order.setPayType(map.get("payType")); + order.setInvoicing("未开票"); + order.setOrderStatus("paid"); + order.setPayTime(new Date()); + + this.addOilTrack(oilOrders.get(i), accountInfo.getStoreId()); + baseMapper.insert(order); + + oilOrder = this.selectOilOrderByOrderNo(orderNo); + this.updateGrowthValue1(oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo); +// this.insertCardBalance((Double.valueOf(oilOrders.get(i).get("liters").toString())-refuelMoneyLiters)*oilPrice,userId,storeId); + + }else { + res.put("error","囤油卡或储值卡余额不足!"); } - }else { - res.put("error","囤油卡余额不足!"); } } if (flag){ + + cashierOrder.setStaffId(Integer.valueOf(map.get("staffId"))); + cashierOrder.setStoreId(accountInfo.getStoreId()); + cashierOrder.setPayUser(userVo1.getMobile()); + cashierOrder.setAmount(oilAmount); + cashierOrder.setPayAmount(oilAmount); + cashierOrder.setStatus(status); + cashierOrder.setPayTime(new Date()); + cashierOrder.setOrderNo(orderNo); + cashierOrder.setOilOrderAmount(oilAmount); +// cashierOrder.setOilDiscountAmount(Double.valueOf(map.get("oilDiscount"))); + cashierOrder.setTerminal(map.get("terminal")); + cashierOrder.setOilOrderId(oilOrder.getId()); cashierOrderService.insertCashierOrder(cashierOrder); + this.insertAllOrderInfo(orderNo, storeId, oilAmount, map.get("payType"), userId, "PC", "1", status); res.put("success","success"); } } }else { - res.put("error","储值卡余额不足!"); - } + if (cardBalance>=oilAmount){ +// 添加油品订单信息 + OilOrder order = new OilOrder(); + for (int i = 0;i < oilOrders.size();i++) { + Double amount = Double.valueOf(oilOrders.get(i).get("amount").toString()); + Double oilPrice = Double.valueOf(oilOrders.get(i).get("oilPrice").toString()); + Double oilNum = amount / oilPrice; + if (i == 0) { + order.setOrderType("主订单"); + order.setOrderAmount(amount); + order.setPayAmount(0.0); + order.setOrderNo(orderNo); + } else { + order.setOrderType("子订单"); + order.setOrderAmount(amount); + order.setPayAmount(0.0); + order.setOrderNo(orderNo + "1"); + } + order.setStoreId(accountInfo.getStoreId()); + order.setUserId(userId); + order.setCommissionAmount(Double.valueOf(map.get("commissionAmount"))); + order.setStaffId(Integer.valueOf(map.get("staffId"))); + order.setTerminal(map.get("terminal")); + order.setOils((String) oilOrders.get(i).get("oilName")); + order.setOilGunNum(oilOrders.get(i).get("gunName").toString()); + order.setOilNum(oilNum); +// order.setDiscountAmount(Double.valueOf(map.get("oilDiscount"))); + order.setPayUser(userVo1.getMobile()); + order.setPayType(map.get("payType")); + order.setInvoicing("未开票"); + order.setOrderStatus("paid"); + order.setPayTime(new Date()); - } + this.addOilTrack(oilOrders.get(i), accountInfo.getStoreId()); + baseMapper.insert(order); + } + OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo); + +// 添加收银台订单信息 + CashierOrder cashierOrder = new CashierOrder(); + cashierOrder.setStaffId(Integer.valueOf(map.get("staffId"))); + cashierOrder.setStoreId(accountInfo.getStoreId()); + cashierOrder.setPayUser(userVo1.getMobile()); + cashierOrder.setAmount(oilAmount); + cashierOrder.setPayAmount(oilAmount); + cashierOrder.setStatus("paid"); + cashierOrder.setPayTime(new Date()); + cashierOrder.setOrderNo(orderNo); + cashierOrder.setOilOrderAmount(oilAmount); +// cashierOrder.setOilDiscountAmount(Double.valueOf(map.get("oilDiscount"))); + cashierOrder.setTerminal(map.get("terminal")); + cashierOrder.setOilOrderId(oilOrder.getId()); + cashierOrderService.insertCashierOrder(cashierOrder); + this.updateGrowthValue1(oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo); + this.insertAllOrderInfo(orderNo,accountInfo.getStoreId(),oilAmount,map.get("payType"),userId,"PC","1","paid"); + +// this.insertCardBalance(oilAmount,userId,storeId); + res.put("success","success"); + }else { + res.put("error","储值卡余额不足!"); + } + } +// } else { +//// 添加油品订单信息 +// OilOrder order = new OilOrder(); +// for (int i = 0;i < oilOrders.size();i++) { +// Double amount = Double.valueOf(oilOrders.get(i).get("amount").toString()); +// Double oilPrice = Double.valueOf(oilOrders.get(i).get("oilPrice").toString()); +// Double oilNum = amount / oilPrice; +// if (i == 0) { +// order.setOrderType("主订单"); +// order.setOrderAmount(amount); +// order.setPayAmount(0.0); +// order.setOrderNo(orderNo); +// } else { +// order.setOrderType("子订单"); +// order.setOrderAmount(amount); +// order.setPayAmount(0.0); +// order.setOrderNo(orderNo + "1"); +// } +// order.setStoreId(accountInfo.getStoreId()); +// order.setUserId(userId); +// order.setCommissionAmount(Double.valueOf(map.get("commissionAmount"))); +// order.setStaffId(Integer.valueOf(map.get("staffId"))); +// order.setTerminal(map.get("terminal")); +// order.setOils((String) oilOrders.get(i).get("oilName")); +// order.setOilGunNum(oilOrders.get(i).get("gunName").toString()); +// order.setOilNum(oilNum); +//// order.setDiscountAmount(Double.valueOf(map.get("oilDiscount"))); +// order.setPayUser(userVo1.getMobile()); +// order.setPayType(map.get("payType")); +// order.setInvoicing("未开票"); +// order.setOrderStatus("paid"); +// order.setPayTime(new Date()); +// +// this.addOilTrack(oilOrders.get(i), accountInfo.getStoreId()); +// baseMapper.insert(order); +// } +// OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo); +// +//// 添加收银台订单信息 +// CashierOrder cashierOrder = new CashierOrder(); +// cashierOrder.setStaffId(Integer.valueOf(map.get("staffId"))); +// cashierOrder.setStoreId(accountInfo.getStoreId()); +// cashierOrder.setPayUser(userVo1.getMobile()); +// cashierOrder.setAmount(oilAmount); +// cashierOrder.setPayAmount(oilAmount); +// cashierOrder.setStatus("paid"); +// cashierOrder.setPayTime(new Date()); +// cashierOrder.setOrderNo(orderNo); +// cashierOrder.setOilOrderAmount(oilAmount); +//// cashierOrder.setOilDiscountAmount(Double.valueOf(map.get("oilDiscount"))); +// cashierOrder.setTerminal(map.get("terminal")); +// cashierOrder.setOilOrderId(oilOrder.getId()); +// cashierOrderService.insertCashierOrder(cashierOrder); +// this.updateGrowthValue1(oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId); +// this.insertAllOrderInfo(orderNo,accountInfo.getStoreId(),oilAmount,map.get("payType"),userId,"PC","1","paid"); +// +// res.put("success","success"); +// } return res; } @@ -640,6 +779,10 @@ public class OilOrderServiceImpl extends ServiceImpl i allOrderInfo.setUserId(userId); allOrderInfo.setPayChannel(payChannel); allOrderInfo.setStatus(status); + if (status.equals("paid")){ + allOrderInfo.setPayMoney(goodsMoney); + allOrderInfo.setPayTime(new Date()); + } if (type.equals("1")){ allOrderInfo.setContent("油品订单"); }else { @@ -658,10 +801,9 @@ public class OilOrderServiceImpl extends ServiceImpl i * @param oilId 油号id * @param refuelMoney 扣除的囤油卡升数 */ - private void updateGrowthValue1(Double oilActualPay,Integer userid,Integer oilId,Double refuelMoney,Integer storeId){ + private void updateGrowthValue1(Double oilActualPay,Integer userid,Integer oilId,Double refuelMoney,Integer storeId,String orderNo){ UserBalance balance = userBalanceService.selectUserBalanceByStorId(userid,storeId); JSONArray refuelMoneys = JSONArray.parseArray(balance.getRefuelMoney()); - if (oilActualPay==0.0){ if (ObjectUtil.isNotEmpty(refuelMoneys)){ List list = new ArrayList<>(); for (Object money : refuelMoneys) { @@ -679,10 +821,9 @@ public class OilOrderServiceImpl extends ServiceImpl i } balance.setRefuelMoney(JSONObject.toJSONString(list)); } - }else { - balance.setCardBalance(balance.getCardBalance()-oilActualPay); - } +// balance.setCardBalance(balance.getCardBalance()-oilActualPay); userBalanceService.updateUserBalance(balance); + this.insertCardBalance(oilActualPay,userid,storeId,orderNo); } @Override @@ -721,9 +862,6 @@ public class OilOrderServiceImpl extends ServiceImpl i return orderNo; } - @Autowired - private OilNumberService oilNumberService; - @Override public Map appletPay(Map map) { String orderNo = map.get("orderNo"); @@ -813,7 +951,7 @@ public class OilOrderServiceImpl extends ServiceImpl i // 判断是否使用储值卡消费 if (!balanceAmount.equals("0")){ - this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId()); + this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId(),orderNo); } // 判断是否需要调起支付 @@ -1011,7 +1149,7 @@ public class OilOrderServiceImpl extends ServiceImpl i * @param oilActualPay 实付金额 * @param userid 用户id * @param oilId 油号 - * @param refuelMoney 加油金信息 + * @param refuelMoney 消费后的加油金信息 * @param storeId 店铺id */ private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney,Integer storeId){ @@ -1036,6 +1174,7 @@ public class OilOrderServiceImpl extends ServiceImpl i refuelMoney2.setOilType(((JSONObject) object).get("oilType").toString()); refuelMoney2.setRefuelMoney("0"); list.add(refuelMoney2); + } } balance.setRefuelMoney(JSONObject.toJSONString(list)); @@ -1101,8 +1240,8 @@ public class OilOrderServiceImpl extends ServiceImpl i * @param userId * @param storeId */ - private void insertCardBalance(Double amount,Integer userId,Integer storeId){ -// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + private void insertCardBalance(Double amount,Integer userId,Integer storeId,String orderNo){ + CardBalanceChange cardBalanceChange = new CardBalanceChange(); // 根据用户id查询用户余额信息 LJStore store = storeService.selectStoreByStoreId(storeId); UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId()); @@ -1110,6 +1249,7 @@ public class OilOrderServiceImpl extends ServiceImpl i // 修改余额信息 Double beforeBalance = balance.getCardBalance(); Double afterBalance = beforeBalance - amount; + cardBalanceChange.setAfterTheChange(afterBalance); balance.setCardBalance(afterBalance); // 修改加油次数 Integer consumeNum = balance.getConsumeNum(); @@ -1118,15 +1258,39 @@ public class OilOrderServiceImpl extends ServiceImpl i } // 添加余额记录信息 - CardBalanceChange cardBalanceChange = new CardBalanceChange(); cardBalanceChange.setUserId(userId); cardBalanceChange.setChangeType("0"); cardBalanceChange.setFromType("油品订单消费"); cardBalanceChange.setBalance(amount); + cardBalanceChange.setOrderNo(orderNo); cardBalanceChangeService.insertCardBalance(cardBalanceChange); } + /** + * 添加囤油卡消费记录 + * @param userId + * @param storeId + * @param oilType + * @param type + * @param oilBalance + * @param afterOilBalance + * @param orderNo + */ + private void insertOilBalance(Integer userId,Integer storeId,String oilType,String type,Double oilBalance,Double afterOilBalance,String orderNo){ + LJStore store = storeService.selectStoreByStoreId(storeId); + OilBalanceChange oilBalanceChange = new OilBalanceChange(); + oilBalanceChange.setUserId(userId); + oilBalanceChange.setStoreId(storeId); + oilBalanceChange.setChainStoreId(store.getChainStoreId()); + oilBalanceChange.setChangeType("0"); + oilBalanceChange.setOilType(oilType); + oilBalanceChange.setType(type); + oilBalanceChange.setFromType("油品订单消费"); + oilBalanceChange.setOrderNo(orderNo); + oilBalanceChangeService.save(oilBalanceChange); + } + @Resource OilOrderMapper oilOrderMapper; @Resource diff --git a/fuintCashierWeb/src/api/cashier/balancecardrecord.js b/fuintCashierWeb/src/api/cashier/balancecardrecord.js new file mode 100644 index 000000000..3ae0e1d11 --- /dev/null +++ b/fuintCashierWeb/src/api/cashier/balancecardrecord.js @@ -0,0 +1,35 @@ +import request from '@/utils/request' + +// 查询优惠券信息列表 +export function listCardBalanceRecord(query) { + return request({ + url: '/business/CardBalanceChange/getStoreOrdersList', + method: 'get', + params: query + }) +} + +// 查询优惠券信息列表 +export function listCardOilRecord(query) { + return request({ + url: '/business/oilBalanceChange', + method: 'get', + params: query + }) +} + +// 查询优惠券信息列表 +export function cardBalanceCount() { + return request({ + url: '/business/CardBalanceChange/getBalanceStoreCount', + method: 'get', + }) +} + +// 查询优惠券信息列表 +export function cardOilCount() { + return request({ + url: '/business/oilBalanceChange/getOilStoreCount', + method: 'get', + }) +} diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue index ba67c7846..0132c2a8d 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue @@ -2565,16 +2565,16 @@ this.loading = true; setTimeout(function (){ _this.loading = false; - _this.isPaySuccess = true; _this.isPay = true; + _this.isPaySuccess = true; _this.resetting1(); },3000) }else { this.loading = true; setTimeout(function (){ _this.loading = false; - _this.isPaySuccess = false; _this.isPay = true; + _this.isPaySuccess = false; _this.resetting1(); this.$modal.msgError(resp.data.error) },3000) @@ -2634,7 +2634,7 @@ let _this = this; this.authCode = ""; if (_this.isPaySuccess == true){ - _this.isPay = false; + // _this.isPay = false; _this.oilAmount = 0; _this.oilActualPay = 0; _this.oilDiscount = 0; diff --git a/fuintCashierWeb/src/views/cashier/vipComponents/balanceList.vue b/fuintCashierWeb/src/views/cashier/vipComponents/balanceList.vue index 0c3550146..6a58d1bee 100644 --- a/fuintCashierWeb/src/views/cashier/vipComponents/balanceList.vue +++ b/fuintCashierWeb/src/views/cashier/vipComponents/balanceList.vue @@ -2,8 +2,8 @@
- - + +
@@ -19,15 +19,35 @@
-
+
储值卡统计
-
-
会员总数
-
55
+ + + + +
+
余额汇总
+
{{ totalBalance }}
+
+
+
充值笔数
+
{{ inCount }}
+
+
+
充值总额
+
{{ totalRecharge }}
+
+
+
消费笔数
+
{{ outCount }}
+
+
+
消费总额
+
{{ totalConsumption }}
@@ -36,105 +56,48 @@
列表
- 新增会员 +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + +
+ :total="total" + :page.sync="queryParams.page" + :limit.sync="queryParams.pageSize" + @current-change="getCardBalanceList">
@@ -142,15 +105,31 @@
-
+
升数卡统计
-
-
会员总数
-
55
+ + + + +
+
充值笔数
+
{{ inCount1 }}
+
+
+
充值总额
+
{{ totalRecharge1 }}
+
+
+
消费笔数
+
{{ outCount1 }}
+
+
+
消费总额
+
{{ totalConsumption1 }}
@@ -159,109 +138,56 @@
列表
- 新增会员 +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
+ :total="total1" + :page.sync="queryParams1.page" + :limit.sync="queryParams1.pageSize" + @current-change="getCardOilList">
-
@@ -270,72 +196,203 @@