diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java index 96ffdcdac..4429da76e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java @@ -13,6 +13,7 @@ import com.fuint.api.fuyou.util.Utils; import com.fuint.business.commission.service.StaffCommissionService; import com.fuint.business.integral.entity.IntegralOrders; import com.fuint.business.integral.service.IntegralOrdersService; +import com.fuint.business.integral.service.IntegralSettingsService; import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService; import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord; @@ -51,6 +52,8 @@ public class FyPayServiceImpl implements FyPayService { private StaffCommissionService staffCommissionService; @Autowired private MerchantConfigRecordService merchantConfigRecordService; + @Resource + private IntegralSettingsService integralSettingsService; /** * 条码支付 @@ -194,14 +197,16 @@ public class FyPayServiceImpl implements FyPayService { oilOrder.setTankId(tankId); oilOrderService.addOilTracks(oilOrder, oilOrder.getStoreId()); } + + if (ObjectUtil.isNotEmpty(oilOrder.getUserId())) integralSettingsService.refuelPoints(oilOrder); // 修改优惠券使用状态 - if (oilOrder.getCouponId()!=null){ - CardFavorableRecord byId = cardFavorableRecordService.getById(oilOrder.getCouponId()); - if (!ObjectUtil.isEmpty(byId)){ - byId.setStatus("1"); - cardFavorableRecordService.updateById(byId); - } - } +// if (oilOrder.getCouponId()!=null){ +// CardFavorableRecord byId = cardFavorableRecordService.getById(oilOrder.getCouponId()); +// if (!ObjectUtil.isEmpty(byId)){ +// byId.setStatus("1"); +// cardFavorableRecordService.updateById(byId); +// } +// } } if (!ObjectUtil.isEmpty(goodsOrder)){ // 商品订单 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralSettingsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralSettingsService.java index d36e7cd1b..bb070f50e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralSettingsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralSettingsService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.integral.entity.IntegralGift; import com.fuint.business.integral.entity.IntegralSettings; +import com.fuint.business.order.entity.OilOrder; import io.lettuce.core.dynamic.annotation.Param; @@ -69,4 +70,9 @@ public interface IntegralSettingsService { IntegralSettings signInFunction(IntegralSettings integralSettings); + /** + * 加油赠送积分 + * @param order + */ + void refuelPoints(OilOrder order); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java index 2f2a74022..7debd205d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java @@ -15,6 +15,7 @@ import com.fuint.business.integral.mapper.IntegralDetailMapper; import com.fuint.business.integral.mapper.IntegralSettingsMapper; import com.fuint.business.integral.service.IntegralDetailService; import com.fuint.business.integral.service.IntegralSettingsService; +import com.fuint.business.order.entity.OilOrder; import com.fuint.business.petrolStationManagement.entity.OilNumber; import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper; import com.fuint.business.storeInformation.entity.LJStore; @@ -107,6 +108,7 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService { refuelConsumptionAmountMap.put("oilName", oilNumber.getOilName() + oilNumber.getOilType()); refuelConsumptionAmountMap.put("amount", 0); refuelConsumptionAmountMap.put("integral", 0); + refuelConsumptionAmountMap.put("oilNameId", oilNumber.getId()); refuelConsumptionAmountList.add(refuelConsumptionAmountMap); } String refuelConsumptionAmount = JSON.toJSONString(refuelConsumptionAmountList); @@ -299,6 +301,69 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService { return null; } + @Override + public void refuelPoints(OilOrder order) { + IntegralSettings integralSettings = integralSettingsMapper.getByStoreId(order.getStoreId()); + if (ObjectUtil.isNotEmpty(integralSettings) && integralSettings.getRefuelPointsRules()==0 + && integralSettings.getRefuelPointsFunction() ==0){ + if (integralSettings.getRefuelSceneType()==0){ +// 按金额 + if (integralSettings.getRefuelAmountType()==0){ +// 按订单金额 + countPoints(integralSettings,order.getOils(),order.getOrderAmount(),order.getUserId()); + }else { +// 按实付金额 + if (integralSettings.getRefuelValueParticipation()==0){ +// 储值金额不参与 + countPoints(integralSettings,order.getOils(),order.getPayAmount(),order.getUserId()); + }else { +// 储值金额参与 + countPoints(integralSettings,order.getOils(),order.getPayAmount()+order.getBalanceAmount(),order.getUserId()); + } + } + }else if (integralSettings.getRefuelSceneType()==1){ +// 按实付金额 + countPoints(integralSettings,order.getOils(),order.getPayAmount()+order.getBalanceAmount(),order.getUserId()); + } + } + } + + /** + * 计算赠送积分 + * @param integralSettings + * @param oilId 油品id + * @param amount 消费金额 + * @param userId 用户id + */ + private void countPoints(IntegralSettings integralSettings,String oilId,Double amount,Integer userId){ + LJStore store = iljStoreService.selectStoreByStoreId(integralSettings.getStoreId()); + UserBalance balance = userBalanceService.selectUserBalance(userId, store.getChainStoreId()); + if (ObjectUtil.isNotEmpty(balance)) { + if (integralSettings.getRefuelSceneRules()==0) { +// 通用规则 + if (integralSettings.getRefuelFuelAmount() <= amount) { + Integer points = balance.getPoints(); + balance.setPoints(points+integralSettings.getRefuelPoints()); + } + } else { +// 油品区分 + JSONArray jsonArray = JSONArray.parseArray(integralSettings.getRefuelConsumptionAmount()); + for (int i = 0;i and order_status = #{order.orderStatus} - - and order_status = 'paid' and remark is null or remark = '' and order_status = 'paid' - and pay_type = #{order.payType} + + and order_status = 'paid' and remark is null and store_id = #{order.storeId} + or remark = '' and order_status = 'paid' and store_id = #{order.storeId} + order by create_time desc 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 2afe2deb1..b5e5041b8 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 @@ -18,6 +18,7 @@ import com.fuint.business.convenienceSore.entity.LJGoods; import com.fuint.business.convenienceSore.entity.SaleDetail; import com.fuint.business.convenienceSore.service.LJGoodsService; import com.fuint.business.convenienceSore.service.SaleDetailService; +import com.fuint.business.integral.service.IntegralSettingsService; import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild; import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountService; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO; @@ -114,6 +115,8 @@ public class OilOrderServiceImpl extends ServiceImpl i private ActiveFullminusService activeFullminusService; @Resource private ActiveDiscountService activeDiscountService; + @Resource + private IntegralSettingsService integralSettingsService; @Override public IPage selectOilOrderList(Page page, OilOrder order) { @@ -487,6 +490,7 @@ public class OilOrderServiceImpl extends ServiceImpl i cashierOrder.setOilDiscountAmount(oilDiscount); cashierOrder.setTerminal(terminal); cashierOrder.setPayType(payType); + cashierOrder.setAfterDiscountAmount(oilAmount+goodsAmount-oilDiscount-goodsDiscount); // 如果金额不等于0调用第三方支付接口 if (!map.get("allAmount").equals("0") && !map.get("payType").equals("CASH")){ @@ -521,7 +525,6 @@ public class OilOrderServiceImpl extends ServiceImpl i // throw new RuntimeException("支付失败"); } }else { - cashierOrder.setPayAmount(oilAmount+goodsAmount-oilDiscount-goodsDiscount); this.insertAllOrderInfo(orderNo,storeId,oilAmount+goodsAmount,Double.valueOf(map.get("allAmount")),payType,userId,"PC","6","paid"); } @@ -531,6 +534,7 @@ public class OilOrderServiceImpl extends ServiceImpl i orders.put("oilOrder",oilOrder2); if (oilOrder2.getOrderStatus().equals("paid")){ cashierOrder.setPayTime(new Date()); + if (ObjectUtil.isNotEmpty(oilOrder2.getUserId())) integralSettingsService.refuelPoints(oilOrder2); } cashierOrder.setOilOrderId(oilOrder2.getId()); } @@ -1221,6 +1225,7 @@ public class OilOrderServiceImpl extends ServiceImpl i } this.updateOilOrder(oilOrder); if (oilOrder.getOrderStatus().equals("paid")) { + if (ObjectUtil.isNotEmpty(oilOrder.getUserId())) integralSettingsService.refuelPoints(oilOrder); this.updateCardAndActiveById(oilOrder.getStoreId(), oilOrder.getUserId(), oilOrder.getActiveId(), oilOrder.getCouponId(), oilOrder.getActiveType(), oilOrder.getOrderAmount(), Integer.valueOf(oilOrder.getOils())); } @@ -1268,6 +1273,7 @@ public class OilOrderServiceImpl extends ServiceImpl i // oilOrder.setPayAmount(oilOrder.getOrderAmount()-oilOrder.getDiscountAmount()); oilOrder.setOrderStatus(status); if (status.equals("paid")){ + if (ObjectUtil.isNotEmpty(oilOrder.getUserId())) integralSettingsService.refuelPoints(oilOrder); oilOrder.setPayTime(new Date()); CardValueChildOrder cardValueChildOrder = cardValueChildOrderService.selectCardValueChildOrderByOrderNo(orderNo); if (ObjectUtil.isNotEmpty(cardValueChildOrder)){ diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue index 9e8d5e687..a149b325a 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue @@ -120,17 +120,17 @@
-¥{{ oilDiscount.toFixed(2) }}
-
+
囤油卡 -
+
({{ item.type }}卡 - 余额:{{ item.refuelMoney }}L) + 余额:{{ item.refuelMoney ? item.refuelMoney : 0.00 }}L)
- {{ consumeRefuelMoney.toFixed(2) }}L
@@ -573,7 +573,7 @@
{{ item.type }}卡 - 余额:{{ item.refuelMoney }}L; + 余额:{{ item.refuelMoney ? item.refuelMoney : 0.00 }}L;
@@ -918,11 +918,7 @@ - +
已选油品 {{ getName(oilNameList,form.oilName) }} @@ -1427,7 +1423,7 @@ {value:"¥300"}, ], // 会员信息 - member:{}, + member:{id:""}, // 会员等级信息 grade:{}, // 会员列表信息 @@ -1631,7 +1627,7 @@ this.getStaff(); this.getList(); this.getCouponList(); - this.getUnitList(); + // this.getUnitList(); }, directives: { // 注册一个局部的自定义指令 v-focus @@ -1673,7 +1669,6 @@ // realName: data.realName, // staffMobile: data.staffMobile, // }, - // console.log('Received data in parent:', data); this.cardFuelDieselForm.mtStaffId = data.mtStaffId this.cardFuelDieselForm.realName = data.realName @@ -1706,9 +1701,7 @@ await getCardValueListApi(quy).then(res => { this.cardValueList = res.data.records; this.cardValueList.sort((a, b) => a.rechargeBalance - b.rechargeBalance); - // console.log("this.grade.name",this.grade) }) - // console.log("this.cardValueList", this.grade) if (this.cardValueList.length > 0) { // 过滤 @@ -1761,7 +1754,6 @@ }, selectOilType(status, oilType) { this.tabOilType = oilType; - // console.log("453",oilType) this.tabOilTypeClick(oilType); }, // 会员充值 @@ -1788,7 +1780,6 @@ // this.cardValueForm.amount = null this.$set(this.cardValueForm, 'amount', data); - // console.log("data17.16", this.cardValueForm.amount) if (!data) { this.cardValueForm.amount = '' @@ -1936,7 +1927,6 @@ this_.isPay = false; this_.isPaySuccess = false; this_.isAwait = true; - console.log("t3") }, 15000) } else if (this.flag === 2) { @@ -1955,7 +1945,6 @@ actualPayment = this.authCode makeChange = this.seekZero } - // console.log("cardFuelDieselForm",this.cardFuelDieselForm) this.cardFuelDieselForm.mtUserId = userForm.id this.cardFuelDieselForm.name = userForm.name this.cardFuelDieselForm.mobile = userForm.mobile @@ -1963,7 +1952,6 @@ this.cardFuelDieselForm.actualPayment = actualPayment this.cardFuelDieselForm.makeChange = makeChange - // console.log("this.cardFuelDieselForm",this.cardFuelDieselForm) let id; @@ -2027,7 +2015,6 @@ }, // 选择余额充值金额 rechargeCard(index, item) { - // console.log("index", index) // this.cardValueForm.amount = null, this.cardValueForm.rechargeType = 0 @@ -2061,7 +2048,6 @@ this.cardValueForm.percentageCommissions = file.percentageCommissions this.cardValueForm.amountCommission = file.amountCommission - // console.log("file.royaltyType ", file.royaltyType ) // 计算员工提成金额 if (file.royaltyType === "3") { @@ -2077,7 +2063,6 @@ }, // 根据油品过滤查询存油卡 async tabOilTypeClick(data) { - // console.log("aaaaaaaaaaaaaa",data) await this.getCardFuelDieselList() this.cardFuelDieselList = this.sourceCardFuelDieselList.filter(item => { @@ -2145,7 +2130,6 @@ let file = {} // 拿到金额 file = this.cardFuelDieselList[index] - // console.log("file",file) this.cardFuelDieselForm.points = file.points this.cardFuelDieselForm.rechargeBalance = file.rechargeBalance this.cardFuelDieselForm.oilType = file.oilType @@ -2276,7 +2260,6 @@ // LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789'); // let preview = LODOP.PREVIEW(); - // console.log("preview",preview); LODOP.PRINT(); } }catch (e){ @@ -2290,7 +2273,6 @@ } //初始化打印函数 let LODOP = getLodop(); // 初始化打印 - console.log(LODOP) if (LODOP) { LODOP.PRINT_INIT(); var bodyStyle = `