From 207ecefc503f8477bb51b73e1ad09cb269b31cdb Mon Sep 17 00:00:00 2001
From: cun-nan <19819293608@163.com>
Date: Wed, 30 Oct 2024 15:52:14 +0800
Subject: [PATCH] 10.30
---
.../convenienceStore/inventory/details.vue | 19 ++---
.../convenienceStore/inventory/index.vue | 60 +++++++++----
.../convenienceSore/entity/MtInventory.java | 10 +++
.../mapper/xml/MtInventoryMapper.xml | 2 +
.../service/impl/MtInventoryServiceImpl.java | 6 ++
.../service/impl/FleetInfoServiceImpl.java | 3 +-
.../service/impl/FleetMemberServiceImpl.java | 21 +++--
.../service/impl/OilOrderServiceImpl.java | 85 +++++++++++--------
.../service/IMtUserFuelService.java | 9 ++
.../service/impl/MtUserFuelServiceImpl.java | 34 ++++++++
.../views/cashier/NewComponents/newHome.vue | 1 +
11 files changed, 182 insertions(+), 68 deletions(-)
diff --git a/fuintAdmin/src/views/convenienceStore/inventory/details.vue b/fuintAdmin/src/views/convenienceStore/inventory/details.vue
index 290e6d25a..0d76939e9 100644
--- a/fuintAdmin/src/views/convenienceStore/inventory/details.vue
+++ b/fuintAdmin/src/views/convenienceStore/inventory/details.vue
@@ -8,29 +8,29 @@
-
+
-
{{inventoryForm.productQuantity}}
+
{{inventoryForm.productQuantity}}
商品数量
-
{{inventoryForm.inventoryQuantity}}
+
{{inventoryForm.inventoryQuantity}}
-
+
盘点数量
-
{{inventoryForm.inventoryDiscrepancy}}
+
{{inventoryForm.inventoryDiscrepancy}}
-
+
库存差异
-
{{inventoryForm.profitLossAmount}}
+
{{inventoryForm.profitLossAmount}}
-
+
盈亏总额
@@ -822,8 +822,7 @@ export default {
width: 212px;
margin-right: 10px;
background: #FFFFFF;
- border-radius: 10px 10px 10px 10px;
- border: 1px solid #EEEEEE;
+ border: 1px solid #FF9655;
border-radius: 10px;
display: flex;
flex-direction: column;
diff --git a/fuintAdmin/src/views/convenienceStore/inventory/index.vue b/fuintAdmin/src/views/convenienceStore/inventory/index.vue
index eb3beb54e..6d88c4969 100644
--- a/fuintAdmin/src/views/convenienceStore/inventory/index.vue
+++ b/fuintAdmin/src/views/convenienceStore/inventory/index.vue
@@ -1,7 +1,7 @@
-
+
@@ -43,13 +43,13 @@
-
+
-
+
{{ scope.row.inventoryQuantity == null ? "-" : scope.row.inventoryQuantity }}
@@ -60,7 +60,7 @@
{{ scope.row.inventoryDiscrepancy == null ? "-" : scope.row.inventoryDiscrepancy }}
-
+
{{ scope.row.profitLossAmount == null ? "-" : scope.row.profitLossAmount }}
@@ -69,43 +69,67 @@
-
待审核
-
已审核入库
-
已作废
-
已审核
+
待审核
+
已审核入库
+
已作废
+
已审核
- {{ scope.row.createByName }}({{ parseTime(scope.row.orderDate) }})
+ {{ scope.row.createByName }}
-
{{ scope.row.approverName == null ? "-" : scope.row.approverName }}
-
+
{{ scope.row.confirmerName == null ? "-" : scope.row.confirmerName }}
+
+
+ {{ parseTime(scope.row.orderDate) }}
+
+
+
+
+ {{ parseTime(scope.row.examineTime) }}
+
+
+
+
+ {{ parseTime(scope.row.storageTime) }}
+
+
处理单据
+ >盘点审核
+
+ 盘点入库
+
+ 查看详情
@@ -211,11 +235,13 @@ export default {
this.inventoryForm.approvalStatus = 'await';
this.refresh();
+ this.inventoryForm.orderDate = this.parseTime(new Date())
const res = await addInventoryApi(this.inventoryForm);
if (res) {
this.$modal.msgSuccess("新建批次成功");
this.getList();
+ this.dispose(res.data)
} else {
this.$modal.msgError("新建批次失败");
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/MtInventory.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/MtInventory.java
index 8df348c67..6f1adaad2 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/MtInventory.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/MtInventory.java
@@ -61,6 +61,16 @@ public class MtInventory extends BaseEntity {
* 店铺ID
*/
private Integer storeId;
+ /**
+ * 审核时间
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+ private Date examineTime;
+ /**
+ * 入库时间
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+ private Date storageTime;
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/xml/MtInventoryMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/xml/MtInventoryMapper.xml
index 8122d7291..12aceb2b0 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/xml/MtInventoryMapper.xml
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/xml/MtInventoryMapper.xml
@@ -141,6 +141,8 @@
mp.store_id AS storeId,
mp.create_time AS createTime,
mp.update_time AS updateTime,
+ mp.examine_time AS examineTime,
+ mp.storage_time AS storageTime,
mp.create_by createBy,
ms1.real_name createByName,
ms2.real_name approverName,
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/MtInventoryServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/MtInventoryServiceImpl.java
index 0906beb4b..4740b3d09 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/MtInventoryServiceImpl.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/MtInventoryServiceImpl.java
@@ -24,6 +24,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.util.Date;
import java.util.List;
/**
@@ -93,6 +94,9 @@ public class MtInventoryServiceImpl implements MtInventoryService {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
mtInventory.setCreateBy(nowAccountInfo.getStaffId().toString());
mtInventory.setStoreId(nowAccountInfo.getStoreId());
+ if (ObjectUtil.isEmpty(mtInventory.getOrderDate())){
+ mtInventory.setOrderDate(new Date());
+ }
this.mtInventoryDao.insert(mtInventory);
return mtInventory;
}
@@ -205,6 +209,7 @@ public class MtInventoryServiceImpl implements MtInventoryService {
MtInventory mtReturns = new MtInventory();
mtReturns.setApprover(nowAccountInfo.getStaffId().toString());
+ mtReturns.setExamineTime(new Date());
mtReturns.setId(id);
int update = mtInventoryDao.update(mtReturns);
return update>0;
@@ -216,6 +221,7 @@ public class MtInventoryServiceImpl implements MtInventoryService {
MtInventory mtReturns = new MtInventory();
mtReturns.setConfirmer(nowAccountInfo.getStaffId().toString());
+ mtReturns.setStorageTime(new Date());
mtReturns.setId(id);
int update = mtInventoryDao.update(mtReturns);
return update>0;
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java
index c900e76cd..73acc58d6 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java
@@ -432,7 +432,8 @@ public class FleetInfoServiceImpl extends ServiceImpl()
.eq(FleetMember::getUserId, allOrderInfo.getUserId())
- .orderBy(true, true, FleetMember::getCreateTime)
+ .eq(FleetMember::getIfLogOff,"0")
+ .orderByDesc(true, FleetMember::getCreateTime)
.last("limit 1"));
// 获取当前车队卡
FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper()
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java
index f5fb77707..2276685fe 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java
@@ -87,7 +87,7 @@ public class FleetMemberServiceImpl extends ServiceImpl()
.eq(FleetMember::getFleetId, fleetMember.getFleetId())
- .eq(FleetMember::getUserId, nowAccountInfo.getId()));
+ .eq(FleetMember::getUserId, nowAccountInfo.getId()));
if (ObjectUtil.isEmpty(fleetMember1)) {
throw new RuntimeException("未绑定该车队,无法查看当前车队成员信息");
}
@@ -132,6 +132,7 @@ public class FleetMemberServiceImpl extends ServiceImpl()
.eq(FleetMember::getMobile, fleetMember.getMobile())
+ .eq(FleetMember::getIfLogOff, "0")
.last("limit 1"));
if (ObjectUtil.isNotEmpty(fleetMember2)) {
throw new RuntimeException("该用户已绑定车队");
@@ -144,7 +145,7 @@ public class FleetMemberServiceImpl extends ServiceImpl()
.eq(MtUser::getMobile, fleetMember.getMobile())
.last("limit 1"));
- if (ObjectUtil.isEmpty(mtUser)){
+ if (ObjectUtil.isEmpty(mtUser)) {
throw new RuntimeException("该手机号在会员列表中不存在");
}
if (ObjectUtil.isEmpty(mtUser)) {
@@ -207,6 +208,13 @@ public class FleetMemberServiceImpl extends ServiceImpl()
.eq(MtUser::getMobile, fleetMember.getMobile())
.last("limit 1"));
- if (ObjectUtil.isEmpty(mtUser)){
+ if (ObjectUtil.isEmpty(mtUser)) {
throw new RuntimeException("该手机号在会员列表中不存在");
}
// 如果不限额的话将成员的余额信息改为车队的余额信息
FleetInfo fleetInfo = fleetInfoService.queryById(fleetMember.getFleetId());
- if (fleetMember.getSecondaryCardType()==1){
+ if (fleetMember.getSecondaryCardType() == 1) {
fleetMember.setSecondaryCardLimit(fleetInfo.getTotalBalance());
- fleetMember.setRemainingCreditLimit(fleetInfo.getTotalBalance()-fleetMember.getUsedCreditLimit());
+ fleetMember.setRemainingCreditLimit(fleetInfo.getTotalBalance() - fleetMember.getUsedCreditLimit());
}
return baseMapper.updateById(fleetMember);
}
@@ -403,7 +411,8 @@ public class FleetMemberServiceImpl extends ServiceImpl()
.eq(FleetMember::getUserId, userId)
- .orderBy(true, true, FleetMember::getCreateTime)
+ .eq(FleetMember::getIfLogOff, "0")
+ .orderByDesc(true,FleetMember::getCreateTime)
.last("limit 1"));
}
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 cf040688d..c0b6ea03d 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
@@ -518,13 +518,13 @@ public class OilOrderServiceImpl extends ServiceImpl i
// 查看车队卡余额是否足够付款
FleetMember fleetMember = null;
- if (payType.equals("car_card_value")){
+ if (payType.equals("car_card_value")) {
if (ObjectUtil.isEmpty(userId)) {
orders.put("error", "请先选择会员信息");
return orders;
}
fleetMember = fleetMemberService.selectByUserId(userId);
- if (fleetMember.getRemainingCreditLimit() i
if (ObjectUtil.isNotEmpty(jsonObject.get("activeType"))) {
order.setActiveType(jsonObject.get("activeType").toString());
}
- if (payType.equals("CASH") || payType.equals("after_pay") || payType.equals("card_value") || payType.equals("car_card_value")) {
+ if (payType.equals("CASH") || payType.equals("after_pay") || payType.equals("card_value") || payType.equals("car_card_value") || payType.equals("fule_card")) {
order.setPayTime(new Date());
order.setOrderStatus("paid");
- if (ObjectUtil.isNotEmpty(userId)) this.insertCardBalance(consumeAmount, userId, storeId, orderNo);
this.addOilTracks(order, storeId);
if (ObjectUtil.isNotEmpty(userId)) {
this.updateGrowthValue(oilAmount, oilActualPay, userId, Integer.valueOf(jsonObject.get("oils").toString()), storeId, orderNo);
+ if (payType.equals("card_value")) {
+ // 修改用户储值卡余额
+ this.insertCardBalance(consumeAmount, userId, storeId, orderNo);
+ }
+ if (payType.equals("fule_card")) {
+ // 修改用户囤油卡余额
+ userFuelService.changeBalance(userId, Integer.valueOf(jsonObject.get("oils").toString()), storeId, nowAccountInfo.getChainStoreId(), Double.valueOf(oilCardAmount), orderNo);
+ }
}
}
if (map.get("allAmount").equals("0")) {
@@ -727,10 +734,11 @@ public class OilOrderServiceImpl extends ServiceImpl i
}
} else {
Double payAmount = map.get("payType").equals("CASH") ? Double.valueOf(map.get("authCode")) : Double.valueOf(map.get("allAmount"));
- this.insertAllOrderInfo(orderNo, storeId, oilAmount + goodsAmount, payAmount, oilDiscount, payType, userId, "PC", "6", "paid",seekZero);
+ this.insertAllOrderInfo(orderNo, storeId, oilAmount + goodsAmount, payAmount, oilDiscount, payType, userId, "PC", "6", "paid", seekZero);
// 添加车队卡订单信息
- if (payType.equals("car_card_value") && ObjectUtil.isNotEmpty(fleetMember)) this.addFleetOrder(orderNo,fleetMember);
+ if (payType.equals("car_card_value") && ObjectUtil.isNotEmpty(fleetMember))
+ this.addFleetOrder(orderNo, fleetMember);
// 计算提成
if (ObjectUtil.isNotEmpty(staffId))
@@ -760,23 +768,24 @@ public class OilOrderServiceImpl extends ServiceImpl i
cashierOrderService.insertCashierOrder(cashierOrder);
// 下单完成需要更新一下优惠券的状态 当订单退款以后也要调用这样的代码修改优惠券的状态
- if(StringUtils.isNotEmpty(map.get("couponId"))){
- CardCouponUser cardCouponUser = cardCouponUserMapper.selectById(map.get("couponId"));
- cardCouponUser.setStatus("1");
- // 查询订单号并赋值
- AllOrderInfoVo allOrderInfoVo = allOrderInfoMapper.selectByOrderNo(orderNo);
- cardCouponUser.setOrderId(allOrderInfoVo.getId());
- cardCouponUserMapper.updateById(cardCouponUser);
+ if (StringUtils.isNotEmpty(map.get("couponId"))) {
+ CardCouponUser cardCouponUser = cardCouponUserMapper.selectById(map.get("couponId"));
+ cardCouponUser.setStatus("1");
+ // 查询订单号并赋值
+ AllOrderInfoVo allOrderInfoVo = allOrderInfoMapper.selectByOrderNo(orderNo);
+ cardCouponUser.setOrderId(allOrderInfoVo.getId());
+ cardCouponUserMapper.updateById(cardCouponUser);
}
return orders;
}
/**
* 添加车队卡订单信息
- * @param orderNo 订单号
+ *
+ * @param orderNo 订单号
* @param fleetMember 车队成员信息
*/
- private void addFleetOrder(String orderNo,FleetMember fleetMember) {
+ private void addFleetOrder(String orderNo, FleetMember fleetMember) {
AllOrderInfoUniVo allOrderInfoUniVo = allOrderInfoService.queryByOrderNo(orderNo);
FleetConsumeRecord fleetConsumeRecord = new FleetConsumeRecord();
fleetConsumeRecord.setOrderNo(orderNo);
@@ -793,7 +802,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
fleetConsumeRecord.setChangeType("0");
fleetConsumeRecord.setFromType("油品");
fleetConsumeRecordService.insert(fleetConsumeRecord);
- fleetInfoService.payFleet(allOrderInfoUniVo.getId().toString(),allOrderInfoUniVo.getPayMoney());
+ fleetInfoService.payFleet(allOrderInfoUniVo.getId().toString(), allOrderInfoUniVo.getPayMoney());
}
// 添加优惠记录
@@ -1123,7 +1132,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
cashierOrder.setSeekZero(BigDecimal.valueOf(0.0));
cashierOrder.setPayType(map.get("payType"));
cashierOrderService.insertCashierOrder(cashierOrder);
- this.insertAllOrderInfo(orderNo, storeId, oilAmount, oilAmount, 0.0, map.get("payType"), userId, "PC", "1", status,0.0);
+ this.insertAllOrderInfo(orderNo, storeId, oilAmount, oilAmount, 0.0, map.get("payType"), userId, "PC", "1", status, 0.0);
if (ObjectUtil.isNotEmpty(map.get("staffId")))
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success");
@@ -1194,7 +1203,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
cashierOrder.setPayType(map.get("payType"));
cashierOrderService.insertCashierOrder(cashierOrder);
this.updateGrowthValue1(oilAmount, oilAmount, userId, Integer.valueOf(oilOrder.getOils()), 0.0, storeId, orderNo);
- this.insertAllOrderInfo(orderNo, accountInfo.getStoreId(), oilAmount, oilAmount, 0.0, map.get("payType"), userId, "PC", "1", "paid",0.0);
+ this.insertAllOrderInfo(orderNo, accountInfo.getStoreId(), oilAmount, oilAmount, 0.0, map.get("payType"), userId, "PC", "1", "paid", 0.0);
if (ObjectUtil.isNotEmpty(map.get("staffId")))
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success");
@@ -1253,7 +1262,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
res.put("error", "余额不足,请分开支付");
return res;
}
- if (fuelAmount < oilCardAmount && cardBalance >= oilActualPay){
+ if (fuelAmount < oilCardAmount && cardBalance >= oilActualPay) {
if (!flag) {
res.put("error", "此油品不支持储值卡支付");
return res;
@@ -1309,7 +1318,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
cashierOrder.setSeekZero(BigDecimal.valueOf(0.0));
cashierOrder.setPayType(map.get("payType"));
cashierOrderService.insertCashierOrder(cashierOrder);
- this.insertAllOrderInfo(orderNo, storeId, oilAmount, oilAmount, 0.0, map.get("payType"), userId, "PC", "1", "paid",0.0);
+ this.insertAllOrderInfo(orderNo, storeId, oilAmount, oilAmount, 0.0, map.get("payType"), userId, "PC", "1", "paid", 0.0);
staffCommissionService.countStaffCommission(accountInfo.getStaffId(), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success");
@@ -1377,7 +1386,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
baseMapper.insert(oilOrders);
this.updateGrowthValue1(oilAmount, 0.0, userId, Integer.valueOf(oilOrders.getOils()), 0.0, storeId, orderNo);
- this.insertAllOrderInfo(orderNo, storeId, oilAmount, oilAmount, oilAmount - lockupAmount, oilOrders.getPayType(), userId, "POS", "1", status,0.0);
+ this.insertAllOrderInfo(orderNo, storeId, oilAmount, oilAmount, oilAmount - lockupAmount, oilOrders.getPayType(), userId, "POS", "1", status, 0.0);
staffCommissionService.countStaffCommission(accountInfo.getStaffId(), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success");
} else {
@@ -1385,7 +1394,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
oilOrders.setOrderStatus(status);
baseMapper.insert(oilOrders);
- this.insertAllOrderInfo(orderNo, accountInfo.getStoreId(), oilAmount, oilAmount, 0.0, oilOrders.getPayType(), userId, "POS", "1", "payFail",0.0);
+ this.insertAllOrderInfo(orderNo, accountInfo.getStoreId(), oilAmount, oilAmount, 0.0, oilOrders.getPayType(), userId, "POS", "1", "payFail", 0.0);
res.put("error", "储值卡余额不足!");
}
@@ -1401,13 +1410,13 @@ public class OilOrderServiceImpl extends ServiceImpl i
OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo);
this.updateGrowthValue1(oilAmount, oilAmount, userId, Integer.valueOf(oilOrder.getOils()), 0.0, storeId, orderNo);
- this.insertAllOrderInfo(orderNo, accountInfo.getStoreId(), oilAmount, oilAmount, 0.0, oilOrders.getPayType(), userId, "POS", "1", "paid",0.0);
+ this.insertAllOrderInfo(orderNo, accountInfo.getStoreId(), oilAmount, oilAmount, 0.0, oilOrders.getPayType(), userId, "POS", "1", "paid", 0.0);
staffCommissionService.countStaffCommission(accountInfo.getStaffId(), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success");
} else {
oilOrders.setOrderStatus("payFail");
baseMapper.insert(oilOrders);
- this.insertAllOrderInfo(orderNo, accountInfo.getStoreId(), oilAmount, oilAmount, 0.0, oilOrders.getPayType(), userId, "POS", "1", "payFail",0.0);
+ this.insertAllOrderInfo(orderNo, accountInfo.getStoreId(), oilAmount, oilAmount, 0.0, oilOrders.getPayType(), userId, "POS", "1", "payFail", 0.0);
res.put("error", "储值卡余额不足!");
}
}
@@ -1419,7 +1428,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
/**
* 添加所有订单信息
*/
- private void insertAllOrderInfo(String orderNo, Integer storeId, Double goodsMoney, Double payAmount, Double discountAmount, String payType, Integer userId, String payChannel, String type, String status,Double seekZero) {
+ private void insertAllOrderInfo(String orderNo, Integer storeId, Double goodsMoney, Double payAmount, Double discountAmount, String payType, Integer userId, String payChannel, String type, String status, Double seekZero) {
AllOrderInfo allOrderInfo = new AllOrderInfo();
allOrderInfo.setOrderNo(orderNo);
allOrderInfo.setType(type);
@@ -1551,6 +1560,8 @@ public class OilOrderServiceImpl extends ServiceImpl i
OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo);
// 获取油品信息
OilNumber oilNumber = oilNumberService.selectOilNumberByOilName(oilOrder.getOils(), oilOrder.getStoreId());
+ // 获取店铺信息
+ LJStore ljStore = storeService.selectStoreByStoreId(oilOrder.getStoreId());
if (ObjectUtils.isNotEmpty(cardFavorableId)) {
Integer userId = nowAccountInfo.getId();
@@ -1578,7 +1589,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
userId = userVo.getId();
if (!isUseChild.equals("yes")) {
applet.put("error", "不可使用子卡消费!");
- this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), 0.0, oilOrder.getDiscountAmount(), oilOrder.getPayType(), userId, oilOrder.getPayType(), "1", "payFail",0.0);
+ this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), 0.0, oilOrder.getDiscountAmount(), oilOrder.getPayType(), userId, oilOrder.getPayType(), "1", "payFail", 0.0);
result = true;
}
}
@@ -1589,7 +1600,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
if (balanceAmount.equals("0") && map.get("payAmount").equals("0")) {
if (Double.compare(oilCardLiters, oilOrder.getOilNum()) != 0) {
applet.put("error", "囤油卡消费升数不对!");
- this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), 0.0, oilOrder.getDiscountAmount(), oilOrder.getPayType(), userId, oilOrder.getPayType(), "1", "payFail",0.0);
+ this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), 0.0, oilOrder.getDiscountAmount(), oilOrder.getPayType(), userId, oilOrder.getPayType(), "1", "payFail", 0.0);
result = true;
}
} else {
@@ -1597,7 +1608,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
Double residueAmount = useLiters * oilNumber.getOilPrice();
if ((Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) - residueAmount) >= 0.05) {
applet.put("error", "消费总金额不对!");
- this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), 0.0, oilOrder.getDiscountAmount(), oilOrder.getPayType(), userId, oilOrder.getPayType(), "1", "payFail",0.0);
+ this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), 0.0, oilOrder.getDiscountAmount(), oilOrder.getPayType(), userId, oilOrder.getPayType(), "1", "payFail", 0.0);
result = true;
}
}
@@ -1607,7 +1618,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
Double realAmount = Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) + Double.valueOf(map.get("discountAmount"));
if (-0.03 >= (realAmount - oilOrder.getOrderAmount()) && (realAmount - oilOrder.getOrderAmount()) >= 0.03) {
applet.put("error", "消费总金额不对!");
- this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), 0.0, oilOrder.getDiscountAmount(), oilOrder.getPayType(), userId, oilOrder.getPayType(), "1", "payFail",0.0);
+ this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), 0.0, oilOrder.getDiscountAmount(), oilOrder.getPayType(), userId, oilOrder.getPayType(), "1", "payFail", 0.0);
result = true;
}
}
@@ -1658,8 +1669,15 @@ public class OilOrderServiceImpl extends ServiceImpl i
this.updateGrowthValue(oilOrder.getOrderAmount(), payAmount, userId, Integer.valueOf(oilOrder.getOils()), oilOrder.getStoreId(), orderNo);
this.addOilTracks(oilOrder, oilOrder.getStoreId());
this.insertCardOrder(oilOrder.getUserId(), oilOrder.getStoreId(), orderNo, oilOrder.getOrderAmount(), "paid", Double.valueOf(balanceAmount), payAmount);
- this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), payAmount, Double.valueOf(discountAmount), oilOrder.getPayType(), oilOrder.getUserId(), "applet", "1", "paid",0.0);
- this.insertCardBalance(Double.valueOf(balanceAmount), userId, oilOrder.getStoreId(), orderNo);
+ this.insertAllOrderInfo(orderNo, oilOrder.getStoreId(), oilOrder.getOrderAmount(), payAmount, Double.valueOf(discountAmount), oilOrder.getPayType(), oilOrder.getUserId(), "applet", "1", "paid", 0.0);
+ if (oilOrder.getPayType().equals("card_value")) {
+ this.insertCardBalance(Double.valueOf(balanceAmount), userId, oilOrder.getStoreId(), orderNo);
+ }
+
+ if (oilOrder.getPayType().equals("fule_card")) {
+ // 修改用户囤油卡余额
+ userFuelService.changeBalance(userId, Integer.valueOf(oilOrder.getOils()), oilOrder.getStoreId(), ljStore.getChainStoreId(), Double.valueOf(oilCardAmount), orderNo);
+ }
if (ObjectUtil.isNotEmpty(oilOrder.getStaffId()))
staffCommissionService.countStaffCommission(oilOrder.getStaffId(), oilOrder.getStoreId(), oilOrder.getOrderAmount(), oilOrder.getOrderAmount(), "1", orderNo);
oilOrder.setPayAmount(payAmount);
@@ -1796,8 +1814,6 @@ public class OilOrderServiceImpl extends ServiceImpl i
this.updateGrowthValue(oilOrder.getOrderAmount(), oilOrder.getPayAmount(), userId, Integer.valueOf(oilOrder.getOils()), oilOrder.getStoreId(), orderNo);
this.addOilTracks(oilOrder, oilOrder.getStoreId());
this.updateCardAndActiveById(oilOrder.getStoreId(), oilOrder.getUserId(), oilOrder.getId());
- if (ObjectUtil.isNotEmpty(userId))
- this.insertCardBalance(oilOrder.getOrderAmount() - oilOrder.getDiscountAmount() - oilOrder.getPayAmount(), userId, oilOrder.getStoreId(), orderNo);
if (ObjectUtil.isNotEmpty(oilOrder.getStaffId())) {
staffCommissionService.countStaffCommission(oilOrder.getStaffId(), oilOrder.getStoreId(), oilOrder.getOrderAmount(), oilOrder.getPayAmount(), "1", orderNo);
}
@@ -1891,6 +1907,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
if (oilName.getOilType().equals("天然气")) {
userBalanceService.growthValue(userid, store.getChainStoreId(), storeId, "3", oilAmount, "油品订单消费", orderNo);
}
+
}
}
@@ -2259,7 +2276,7 @@ public class OilOrderServiceImpl extends ServiceImpl i
staffCommissionService.countStaffCommission(nowAccountInfo.getStaffId(), nowAccountInfo.getStoreId(), oilOrderVo.getOrderAmount(), oilOrderVo.getPayAmount(), "1", orderNo);
this.addOilTracks(oilOrderVo, nowAccountInfo.getStoreId());
this.updateCardAndActiveById(nowAccountInfo.getStoreId(), oilOrderVo.getUserId(), oilOrderVo.getId());
- this.insertAllOrderInfo(orderNo, nowAccountInfo.getStoreId(), oilOrderVo.getOrderAmount(), oilOrderVo.getPayAmount(), oilOrderVo.getDiscountAmount(), oilOrderVo.getPayType(), oilOrderVo.getUserId(), "POS", "1", "paid",0.0);
+ this.insertAllOrderInfo(orderNo, nowAccountInfo.getStoreId(), oilOrderVo.getOrderAmount(), oilOrderVo.getPayAmount(), oilOrderVo.getDiscountAmount(), oilOrderVo.getPayType(), oilOrderVo.getUserId(), "POS", "1", "paid", 0.0);
this.insertFavorable(oilOrderVo, oilOrderVo.getOilCardAmount1());
if (ObjectUtil.isNotEmpty(oilOrderVo.getUserId())) integralSettingsService.refuelPoints(oilOrderVo);
//修改优惠券使用状态
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/IMtUserFuelService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/IMtUserFuelService.java
index 8851c1d3a..7e9f1baed 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/IMtUserFuelService.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/IMtUserFuelService.java
@@ -19,4 +19,13 @@ public interface IMtUserFuelService extends IService {
* @return
*/
Double selectByUserIdAndOilId(Integer userId, Integer oilId, Integer storeId);
+
+ /**
+ * 根据用户id和油号id修改油量信息并添加消耗记录(囤油卡支付)
+ * @param userId
+ * @param oilId
+ * @param storeId
+ * @param balance
+ */
+ void changeBalance(Integer userId, Integer oilId, Integer storeId, Integer chainStoreId, Double balance,String orderNo);
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserFuelServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserFuelServiceImpl.java
index 9c602176d..a43b70521 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserFuelServiceImpl.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserFuelServiceImpl.java
@@ -2,10 +2,15 @@ package com.fuint.business.userManager.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
+import com.fuint.business.marketingActivity.cardFule.service.CardFuelChangeService;
+import com.fuint.business.petrolStationManagement.entity.OilName;
+import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.userManager.entity.MtUserFuel;
import com.fuint.business.userManager.mapper.MtUserFuelMapper;
import com.fuint.business.userManager.service.IMtUserFuelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@@ -18,6 +23,10 @@ import org.springframework.stereotype.Service;
*/
@Service
public class MtUserFuelServiceImpl extends ServiceImpl implements IMtUserFuelService {
+ @Autowired
+ private CardFuelChangeService cardFuelChangeService;
+ @Autowired
+ private OilNameService oilNameService;
@Override
public Double selectByUserIdAndOilId(Integer userId, Integer oilId, Integer storeId) {
@@ -30,4 +39,29 @@ public class MtUserFuelServiceImpl extends ServiceImpl