This commit is contained in:
cun-nan 2024-10-30 15:52:14 +08:00
parent 0b9b0a6c60
commit 207ecefc50
11 changed files with 182 additions and 68 deletions

View File

@ -8,29 +8,29 @@
</div> </div>
<div class="" style="height: 110px; display: flex; justify-content: space-between;"> <div class="" style="height: 110px; display: flex; justify-content: space-between;">
<div style="height: 100%; display: flex; justify-content: space-between;"> <div style="height: 100%; display: flex; justify-content: space-between;">
<div style="height: 100%; width: 70%; display: flex; justify-content: space-between;font-family: YouSheBiaoTiHei"> <div style="height: 100%; width: 70%; display: flex; justify-content: space-between;">
<div class="box"> <div class="box">
<span style="font-size: 26px;color: #3B6ADE;font-weight: bold" >{{inventoryForm.productQuantity}}</span> <span style="font-size: 26px;color: #0DC291;font-weight: bold" >{{inventoryForm.productQuantity}}</span>
<span style="display: flex"> <span style="display: flex">
<div style="background-color: #0DC291;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div> <div style="background-color: #0DC291;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
商品数量</span> 商品数量</span>
</div> </div>
<div class="box"> <div class="box">
<span style="font-size: 26px;color: #FF4347;font-weight: bold">{{inventoryForm.inventoryQuantity}}</span> <span style="font-size: 26px;color: #00CAFF;font-weight: bold">{{inventoryForm.inventoryQuantity}}</span>
<span style="display: flex"> <span style="display: flex">
<div style="background-color: #3b7cde;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div> <div style="background-color: #00CAFF;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
盘点数量</span> 盘点数量</span>
</div> </div>
<div class="box"> <div class="box">
<span style="font-size: 26px;color: #3B6ADE;font-weight: bold" >{{inventoryForm.inventoryDiscrepancy}}</span> <span style="font-size: 26px;color: #F44522;font-weight: bold" >{{inventoryForm.inventoryDiscrepancy}}</span>
<span style="display: flex"> <span style="display: flex">
<div style="background-color: #3B6ADE;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div> <div style="background-color: #F44522;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
库存差异</span> 库存差异</span>
</div> </div>
<div class="box"> <div class="box">
<span style="font-size: 26px;color: #FF4347;font-weight: bold">{{inventoryForm.profitLossAmount}}</span> <span style="font-size: 26px;color: #FA6400;font-weight: bold">{{inventoryForm.profitLossAmount}}</span>
<span style="display: flex"> <span style="display: flex">
<div style="background-color: #FF4347;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div> <div style="background-color: #FA6400;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
盈亏总额 盈亏总额
</span> </span>
</div> </div>
@ -822,8 +822,7 @@ export default {
width: 212px; width: 212px;
margin-right: 10px; margin-right: 10px;
background: #FFFFFF; background: #FFFFFF;
border-radius: 10px 10px 10px 10px; border: 1px solid #FF9655;
border: 1px solid #EEEEEE;
border-radius: 10px; border-radius: 10px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="card-change"> <div class="card-change">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="60px">
<el-form-item label="" prop="orderNumber"> <el-form-item label="" prop="orderNumber">
<el-input v-model="queryParams.orderNumber" placeholder="请输入盘点单号"/> <el-input v-model="queryParams.orderNumber" placeholder="请输入盘点单号"/>
</el-form-item> </el-form-item>
@ -43,13 +43,13 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="height: 70vh;overflow: auto"> <div style="height: 74vh;overflow: auto">
<el-table ref="tables" border <el-table ref="tables" border
v-loading="loading" v-loading="loading"
:data="inventoryList" :data="inventoryList"
:default-sort="defaultSort"> :default-sort="defaultSort">
<el-table-column label="序号" align="center" type="index" width="60"></el-table-column> <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
<el-table-column label="盘点批次" align="center" prop="orderNumber"></el-table-column> <el-table-column label="盘点单号" align="center" prop="orderNumber"></el-table-column>
<el-table-column label="盘点数量" align="center" prop="inventoryQuantity"> <el-table-column label="盘点数量" align="center" prop="inventoryQuantity">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.inventoryQuantity == null ? "-" : scope.row.inventoryQuantity }}</span> <span>{{ scope.row.inventoryQuantity == null ? "-" : scope.row.inventoryQuantity }}</span>
@ -60,7 +60,7 @@
<span>{{ scope.row.inventoryDiscrepancy == null ? "-" : scope.row.inventoryDiscrepancy }}</span> <span>{{ scope.row.inventoryDiscrepancy == null ? "-" : scope.row.inventoryDiscrepancy }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="盈亏金额" align="center" prop="profitLossAmount"> <el-table-column label="盈亏金额(元)" align="center" prop="profitLossAmount">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.profitLossAmount == null ? "-" : scope.row.profitLossAmount }}</span> <span>{{ scope.row.profitLossAmount == null ? "-" : scope.row.profitLossAmount }}</span>
</template> </template>
@ -69,43 +69,67 @@
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<el-tag v-if="scope.row.approvalStatus == 'await'" size="medium">待审核</el-tag> <div style="color: #FF9655" v-if="scope.row.approvalStatus == 'await'">待审核</div>
<el-tag v-if="scope.row.approvalStatus == 'qrts'" type="success" size="medium">已审核入库</el-tag> <div style="color: #0DC291" v-if="scope.row.approvalStatus == 'qrts'" >已审核入库</div>
<el-tag v-if="scope.row.approvalStatus == 'yzf'" type="danger" size="medium">已作废</el-tag> <div style="color: #F44522" v-if="scope.row.approvalStatus == 'yzf'">已作废</div>
<el-tag v-if="scope.row.approvalStatus == 'ysh'" type="success" size="medium">已审核</el-tag> <div style="color: #409EFF" v-if="scope.row.approvalStatus == 'ysh'" >已审核</div>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="制单人" align="center" prop="createByName" width="230px"> <el-table-column label="制单人" align="center" prop="createByName" width="230px">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.createByName }}({{ parseTime(scope.row.orderDate) }})</span> <span>{{ scope.row.createByName }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="制单日期" align="center" prop="orderDate" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderDate) }}</span>
</template>
</el-table-column> -->
<el-table-column label="审核人" align="center" prop="approverName"> <el-table-column label="审核人" align="center" prop="approverName">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.approverName == null ? "-" : scope.row.approverName }}</span> <span>{{ scope.row.approverName == null ? "-" : scope.row.approverName }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="确认人" align="center" prop="confirmerName"> <el-table-column label="入库人" align="center" prop="confirmerName">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.confirmerName == null ? "-" : scope.row.confirmerName }}</span> <span>{{ scope.row.confirmerName == null ? "-" : scope.row.confirmerName }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="制单时间" align="center" prop="orderDate" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderDate) }}</span>
</template>
</el-table-column>
<el-table-column label="审核时间" align="center" prop="examineTime" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.examineTime) }}</span>
</template>
</el-table-column>
<el-table-column label="入库时间" align="center" prop="storageTime" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.storageTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" v-if="scope.row.approvalStatus == 'await'"
@click="dispose(scope.row)" @click="dispose(scope.row)"
>处理单据 >盘点审核
</el-button>
<el-button
size="mini"
type="text"
v-else-if="scope.row.approvalStatus == 'ysh'"
@click="dispose(scope.row)"
>盘点入库
</el-button>
<el-button
size="mini"
type="text"
v-else
@click="dispose(scope.row)"
>查看详情
</el-button> </el-button>
</template> </template>
@ -211,11 +235,13 @@ export default {
this.inventoryForm.approvalStatus = 'await'; this.inventoryForm.approvalStatus = 'await';
this.refresh(); this.refresh();
this.inventoryForm.orderDate = this.parseTime(new Date())
const res = await addInventoryApi(this.inventoryForm); const res = await addInventoryApi(this.inventoryForm);
if (res) { if (res) {
this.$modal.msgSuccess("新建批次成功"); this.$modal.msgSuccess("新建批次成功");
this.getList(); this.getList();
this.dispose(res.data)
} else { } else {
this.$modal.msgError("新建批次失败"); this.$modal.msgError("新建批次失败");
} }

View File

@ -61,6 +61,16 @@ public class MtInventory extends BaseEntity {
* 店铺ID * 店铺ID
*/ */
private Integer storeId; 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;
} }

View File

@ -141,6 +141,8 @@
mp.store_id AS storeId, mp.store_id AS storeId,
mp.create_time AS createTime, mp.create_time AS createTime,
mp.update_time AS updateTime, mp.update_time AS updateTime,
mp.examine_time AS examineTime,
mp.storage_time AS storageTime,
mp.create_by createBy, mp.create_by createBy,
ms1.real_name createByName, ms1.real_name createByName,
ms2.real_name approverName, ms2.real_name approverName,

View File

@ -24,6 +24,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -93,6 +94,9 @@ public class MtInventoryServiceImpl implements MtInventoryService {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
mtInventory.setCreateBy(nowAccountInfo.getStaffId().toString()); mtInventory.setCreateBy(nowAccountInfo.getStaffId().toString());
mtInventory.setStoreId(nowAccountInfo.getStoreId()); mtInventory.setStoreId(nowAccountInfo.getStoreId());
if (ObjectUtil.isEmpty(mtInventory.getOrderDate())){
mtInventory.setOrderDate(new Date());
}
this.mtInventoryDao.insert(mtInventory); this.mtInventoryDao.insert(mtInventory);
return mtInventory; return mtInventory;
} }
@ -205,6 +209,7 @@ public class MtInventoryServiceImpl implements MtInventoryService {
MtInventory mtReturns = new MtInventory(); MtInventory mtReturns = new MtInventory();
mtReturns.setApprover(nowAccountInfo.getStaffId().toString()); mtReturns.setApprover(nowAccountInfo.getStaffId().toString());
mtReturns.setExamineTime(new Date());
mtReturns.setId(id); mtReturns.setId(id);
int update = mtInventoryDao.update(mtReturns); int update = mtInventoryDao.update(mtReturns);
return update>0; return update>0;
@ -216,6 +221,7 @@ public class MtInventoryServiceImpl implements MtInventoryService {
MtInventory mtReturns = new MtInventory(); MtInventory mtReturns = new MtInventory();
mtReturns.setConfirmer(nowAccountInfo.getStaffId().toString()); mtReturns.setConfirmer(nowAccountInfo.getStaffId().toString());
mtReturns.setStorageTime(new Date());
mtReturns.setId(id); mtReturns.setId(id);
int update = mtInventoryDao.update(mtReturns); int update = mtInventoryDao.update(mtReturns);
return update>0; return update>0;

View File

@ -432,7 +432,8 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper, FleetInfo
//查找车队成员 //查找车队成员
FleetMember fleetMember = fleetMemberMapper.selectOne(new LambdaQueryWrapper<FleetMember>() FleetMember fleetMember = fleetMemberMapper.selectOne(new LambdaQueryWrapper<FleetMember>()
.eq(FleetMember::getUserId, allOrderInfo.getUserId()) .eq(FleetMember::getUserId, allOrderInfo.getUserId())
.orderBy(true, true, FleetMember::getCreateTime) .eq(FleetMember::getIfLogOff,"0")
.orderByDesc(true, FleetMember::getCreateTime)
.last("limit 1")); .last("limit 1"));
// 获取当前车队卡 // 获取当前车队卡
FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper<FleetInfo>() FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper<FleetInfo>()

View File

@ -87,7 +87,7 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
FleetMember fleetMember1 = baseMapper.selectOne(new LambdaQueryWrapper<FleetMember>() FleetMember fleetMember1 = baseMapper.selectOne(new LambdaQueryWrapper<FleetMember>()
.eq(FleetMember::getFleetId, fleetMember.getFleetId()) .eq(FleetMember::getFleetId, fleetMember.getFleetId())
.eq(FleetMember::getUserId, nowAccountInfo.getId())); .eq(FleetMember::getUserId, nowAccountInfo.getId()));
if (ObjectUtil.isEmpty(fleetMember1)) { if (ObjectUtil.isEmpty(fleetMember1)) {
throw new RuntimeException("未绑定该车队,无法查看当前车队成员信息"); throw new RuntimeException("未绑定该车队,无法查看当前车队成员信息");
} }
@ -132,6 +132,7 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
//判断用户是否加入车队 //判断用户是否加入车队
FleetMember fleetMember2 = baseMapper.selectOne(new LambdaQueryWrapper<FleetMember>() FleetMember fleetMember2 = baseMapper.selectOne(new LambdaQueryWrapper<FleetMember>()
.eq(FleetMember::getMobile, fleetMember.getMobile()) .eq(FleetMember::getMobile, fleetMember.getMobile())
.eq(FleetMember::getIfLogOff, "0")
.last("limit 1")); .last("limit 1"));
if (ObjectUtil.isNotEmpty(fleetMember2)) { if (ObjectUtil.isNotEmpty(fleetMember2)) {
throw new RuntimeException("该用户已绑定车队"); throw new RuntimeException("该用户已绑定车队");
@ -144,7 +145,7 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
MtUser mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper<MtUser>() MtUser mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper<MtUser>()
.eq(MtUser::getMobile, fleetMember.getMobile()) .eq(MtUser::getMobile, fleetMember.getMobile())
.last("limit 1")); .last("limit 1"));
if (ObjectUtil.isEmpty(mtUser)){ if (ObjectUtil.isEmpty(mtUser)) {
throw new RuntimeException("该手机号在会员列表中不存在"); throw new RuntimeException("该手机号在会员列表中不存在");
} }
if (ObjectUtil.isEmpty(mtUser)) { if (ObjectUtil.isEmpty(mtUser)) {
@ -207,6 +208,13 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
createVaseInfo(mtUser, nowAccountInfo.getStoreId().toString(), null, null); createVaseInfo(mtUser, nowAccountInfo.getStoreId().toString(), null, null);
} }
// 如果不限额的话将成员的余额信息改为车队的余额信息
FleetInfo fleetInfo = fleetInfoService.queryById(fleetMember.getFleetId());
if (fleetMember.getSecondaryCardType() == 1) {
fleetMember.setSecondaryCardLimit(fleetInfo.getTotalBalance());
fleetMember.setRemainingCreditLimit(fleetInfo.getTotalBalance() - fleetMember.getUsedCreditLimit());
}
fleetMember.setUserId(mtUser.getId()); fleetMember.setUserId(mtUser.getId());
fleetMember.setCarNum(mtUser.getCarNo()); fleetMember.setCarNum(mtUser.getCarNo());
fleetMember.setStoreId(nowAccountInfo.getStoreId()); fleetMember.setStoreId(nowAccountInfo.getStoreId());
@ -253,14 +261,14 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
MtUser mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper<MtUser>() MtUser mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper<MtUser>()
.eq(MtUser::getMobile, fleetMember.getMobile()) .eq(MtUser::getMobile, fleetMember.getMobile())
.last("limit 1")); .last("limit 1"));
if (ObjectUtil.isEmpty(mtUser)){ if (ObjectUtil.isEmpty(mtUser)) {
throw new RuntimeException("该手机号在会员列表中不存在"); throw new RuntimeException("该手机号在会员列表中不存在");
} }
// 如果不限额的话将成员的余额信息改为车队的余额信息 // 如果不限额的话将成员的余额信息改为车队的余额信息
FleetInfo fleetInfo = fleetInfoService.queryById(fleetMember.getFleetId()); FleetInfo fleetInfo = fleetInfoService.queryById(fleetMember.getFleetId());
if (fleetMember.getSecondaryCardType()==1){ if (fleetMember.getSecondaryCardType() == 1) {
fleetMember.setSecondaryCardLimit(fleetInfo.getTotalBalance()); fleetMember.setSecondaryCardLimit(fleetInfo.getTotalBalance());
fleetMember.setRemainingCreditLimit(fleetInfo.getTotalBalance()-fleetMember.getUsedCreditLimit()); fleetMember.setRemainingCreditLimit(fleetInfo.getTotalBalance() - fleetMember.getUsedCreditLimit());
} }
return baseMapper.updateById(fleetMember); return baseMapper.updateById(fleetMember);
} }
@ -403,7 +411,8 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
public FleetMember selectByUserId(Integer userId) { public FleetMember selectByUserId(Integer userId) {
return baseMapper.selectOne(new LambdaQueryWrapper<FleetMember>() return baseMapper.selectOne(new LambdaQueryWrapper<FleetMember>()
.eq(FleetMember::getUserId, userId) .eq(FleetMember::getUserId, userId)
.orderBy(true, true, FleetMember::getCreateTime) .eq(FleetMember::getIfLogOff, "0")
.orderByDesc(true,FleetMember::getCreateTime)
.last("limit 1")); .last("limit 1"));
} }

View File

@ -518,13 +518,13 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 查看车队卡余额是否足够付款 // 查看车队卡余额是否足够付款
FleetMember fleetMember = null; FleetMember fleetMember = null;
if (payType.equals("car_card_value")){ if (payType.equals("car_card_value")) {
if (ObjectUtil.isEmpty(userId)) { if (ObjectUtil.isEmpty(userId)) {
orders.put("error", "请先选择会员信息"); orders.put("error", "请先选择会员信息");
return orders; return orders;
} }
fleetMember = fleetMemberService.selectByUserId(userId); fleetMember = fleetMemberService.selectByUserId(userId);
if (fleetMember.getRemainingCreditLimit()<oilActualPay){ if (fleetMember.getRemainingCreditLimit() < oilActualPay) {
orders.put("error", "余额不足,请分开支付"); orders.put("error", "余额不足,请分开支付");
return orders; return orders;
} }
@ -651,13 +651,20 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
if (ObjectUtil.isNotEmpty(jsonObject.get("activeType"))) { if (ObjectUtil.isNotEmpty(jsonObject.get("activeType"))) {
order.setActiveType(jsonObject.get("activeType").toString()); 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.setPayTime(new Date());
order.setOrderStatus("paid"); order.setOrderStatus("paid");
if (ObjectUtil.isNotEmpty(userId)) this.insertCardBalance(consumeAmount, userId, storeId, orderNo);
this.addOilTracks(order, storeId); this.addOilTracks(order, storeId);
if (ObjectUtil.isNotEmpty(userId)) { if (ObjectUtil.isNotEmpty(userId)) {
this.updateGrowthValue(oilAmount, oilActualPay, userId, Integer.valueOf(jsonObject.get("oils").toString()), storeId, orderNo); 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")) { if (map.get("allAmount").equals("0")) {
@ -727,10 +734,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
} }
} else { } else {
Double payAmount = map.get("payType").equals("CASH") ? Double.valueOf(map.get("authCode")) : Double.valueOf(map.get("allAmount")); 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)) if (ObjectUtil.isNotEmpty(staffId))
@ -760,23 +768,24 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cashierOrderService.insertCashierOrder(cashierOrder); cashierOrderService.insertCashierOrder(cashierOrder);
// 下单完成需要更新一下优惠券的状态 当订单退款以后也要调用这样的代码修改优惠券的状态 // 下单完成需要更新一下优惠券的状态 当订单退款以后也要调用这样的代码修改优惠券的状态
if(StringUtils.isNotEmpty(map.get("couponId"))){ if (StringUtils.isNotEmpty(map.get("couponId"))) {
CardCouponUser cardCouponUser = cardCouponUserMapper.selectById(map.get("couponId")); CardCouponUser cardCouponUser = cardCouponUserMapper.selectById(map.get("couponId"));
cardCouponUser.setStatus("1"); cardCouponUser.setStatus("1");
// 查询订单号并赋值 // 查询订单号并赋值
AllOrderInfoVo allOrderInfoVo = allOrderInfoMapper.selectByOrderNo(orderNo); AllOrderInfoVo allOrderInfoVo = allOrderInfoMapper.selectByOrderNo(orderNo);
cardCouponUser.setOrderId(allOrderInfoVo.getId()); cardCouponUser.setOrderId(allOrderInfoVo.getId());
cardCouponUserMapper.updateById(cardCouponUser); cardCouponUserMapper.updateById(cardCouponUser);
} }
return orders; return orders;
} }
/** /**
* 添加车队卡订单信息 * 添加车队卡订单信息
* @param orderNo 订单号 *
* @param orderNo 订单号
* @param fleetMember 车队成员信息 * @param fleetMember 车队成员信息
*/ */
private void addFleetOrder(String orderNo,FleetMember fleetMember) { private void addFleetOrder(String orderNo, FleetMember fleetMember) {
AllOrderInfoUniVo allOrderInfoUniVo = allOrderInfoService.queryByOrderNo(orderNo); AllOrderInfoUniVo allOrderInfoUniVo = allOrderInfoService.queryByOrderNo(orderNo);
FleetConsumeRecord fleetConsumeRecord = new FleetConsumeRecord(); FleetConsumeRecord fleetConsumeRecord = new FleetConsumeRecord();
fleetConsumeRecord.setOrderNo(orderNo); fleetConsumeRecord.setOrderNo(orderNo);
@ -793,7 +802,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
fleetConsumeRecord.setChangeType("0"); fleetConsumeRecord.setChangeType("0");
fleetConsumeRecord.setFromType("油品"); fleetConsumeRecord.setFromType("油品");
fleetConsumeRecordService.insert(fleetConsumeRecord); 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<OilOrderMapper, OilOrder> i
cashierOrder.setSeekZero(BigDecimal.valueOf(0.0)); cashierOrder.setSeekZero(BigDecimal.valueOf(0.0));
cashierOrder.setPayType(map.get("payType")); cashierOrder.setPayType(map.get("payType"));
cashierOrderService.insertCashierOrder(cashierOrder); 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"))) if (ObjectUtil.isNotEmpty(map.get("staffId")))
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")), storeId, oilAmount, oilAmount, "1", orderNo); staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success"); res.put("success", "success");
@ -1194,7 +1203,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cashierOrder.setPayType(map.get("payType")); cashierOrder.setPayType(map.get("payType"));
cashierOrderService.insertCashierOrder(cashierOrder); cashierOrderService.insertCashierOrder(cashierOrder);
this.updateGrowthValue1(oilAmount, oilAmount, userId, Integer.valueOf(oilOrder.getOils()), 0.0, storeId, orderNo); 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"))) if (ObjectUtil.isNotEmpty(map.get("staffId")))
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")), storeId, oilAmount, oilAmount, "1", orderNo); staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success"); res.put("success", "success");
@ -1253,7 +1262,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
res.put("error", "余额不足,请分开支付"); res.put("error", "余额不足,请分开支付");
return res; return res;
} }
if (fuelAmount < oilCardAmount && cardBalance >= oilActualPay){ if (fuelAmount < oilCardAmount && cardBalance >= oilActualPay) {
if (!flag) { if (!flag) {
res.put("error", "此油品不支持储值卡支付"); res.put("error", "此油品不支持储值卡支付");
return res; return res;
@ -1309,7 +1318,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cashierOrder.setSeekZero(BigDecimal.valueOf(0.0)); cashierOrder.setSeekZero(BigDecimal.valueOf(0.0));
cashierOrder.setPayType(map.get("payType")); cashierOrder.setPayType(map.get("payType"));
cashierOrderService.insertCashierOrder(cashierOrder); 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); staffCommissionService.countStaffCommission(accountInfo.getStaffId(), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success"); res.put("success", "success");
@ -1377,7 +1386,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
baseMapper.insert(oilOrders); baseMapper.insert(oilOrders);
this.updateGrowthValue1(oilAmount, 0.0, userId, Integer.valueOf(oilOrders.getOils()), 0.0, storeId, orderNo); 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); staffCommissionService.countStaffCommission(accountInfo.getStaffId(), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success"); res.put("success", "success");
} else { } else {
@ -1385,7 +1394,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
oilOrders.setOrderStatus(status); oilOrders.setOrderStatus(status);
baseMapper.insert(oilOrders); 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", "储值卡余额不足!"); res.put("error", "储值卡余额不足!");
} }
@ -1401,13 +1410,13 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo); OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo);
this.updateGrowthValue1(oilAmount, oilAmount, userId, Integer.valueOf(oilOrder.getOils()), 0.0, storeId, 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); staffCommissionService.countStaffCommission(accountInfo.getStaffId(), storeId, oilAmount, oilAmount, "1", orderNo);
res.put("success", "success"); res.put("success", "success");
} else { } else {
oilOrders.setOrderStatus("payFail"); oilOrders.setOrderStatus("payFail");
baseMapper.insert(oilOrders); 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", "储值卡余额不足!"); res.put("error", "储值卡余额不足!");
} }
} }
@ -1419,7 +1428,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> 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 allOrderInfo = new AllOrderInfo();
allOrderInfo.setOrderNo(orderNo); allOrderInfo.setOrderNo(orderNo);
allOrderInfo.setType(type); allOrderInfo.setType(type);
@ -1551,6 +1560,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo); OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo);
// 获取油品信息 // 获取油品信息
OilNumber oilNumber = oilNumberService.selectOilNumberByOilName(oilOrder.getOils(), oilOrder.getStoreId()); OilNumber oilNumber = oilNumberService.selectOilNumberByOilName(oilOrder.getOils(), oilOrder.getStoreId());
// 获取店铺信息
LJStore ljStore = storeService.selectStoreByStoreId(oilOrder.getStoreId());
if (ObjectUtils.isNotEmpty(cardFavorableId)) { if (ObjectUtils.isNotEmpty(cardFavorableId)) {
Integer userId = nowAccountInfo.getId(); Integer userId = nowAccountInfo.getId();
@ -1578,7 +1589,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
userId = userVo.getId(); userId = userVo.getId();
if (!isUseChild.equals("yes")) { if (!isUseChild.equals("yes")) {
applet.put("error", "不可使用子卡消费!"); 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; result = true;
} }
} }
@ -1589,7 +1600,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
if (balanceAmount.equals("0") && map.get("payAmount").equals("0")) { if (balanceAmount.equals("0") && map.get("payAmount").equals("0")) {
if (Double.compare(oilCardLiters, oilOrder.getOilNum()) != 0) { if (Double.compare(oilCardLiters, oilOrder.getOilNum()) != 0) {
applet.put("error", "囤油卡消费升数不对!"); 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; result = true;
} }
} else { } else {
@ -1597,7 +1608,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
Double residueAmount = useLiters * oilNumber.getOilPrice(); Double residueAmount = useLiters * oilNumber.getOilPrice();
if ((Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) - residueAmount) >= 0.05) { if ((Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) - residueAmount) >= 0.05) {
applet.put("error", "消费总金额不对!"); 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; result = true;
} }
} }
@ -1607,7 +1618,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
Double realAmount = Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) + Double.valueOf(map.get("discountAmount")); 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) { if (-0.03 >= (realAmount - oilOrder.getOrderAmount()) && (realAmount - oilOrder.getOrderAmount()) >= 0.03) {
applet.put("error", "消费总金额不对!"); 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; result = true;
} }
} }
@ -1658,8 +1669,15 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
this.updateGrowthValue(oilOrder.getOrderAmount(), payAmount, userId, Integer.valueOf(oilOrder.getOils()), oilOrder.getStoreId(), orderNo); this.updateGrowthValue(oilOrder.getOrderAmount(), payAmount, userId, Integer.valueOf(oilOrder.getOils()), oilOrder.getStoreId(), orderNo);
this.addOilTracks(oilOrder, oilOrder.getStoreId()); this.addOilTracks(oilOrder, oilOrder.getStoreId());
this.insertCardOrder(oilOrder.getUserId(), oilOrder.getStoreId(), orderNo, oilOrder.getOrderAmount(), "paid", Double.valueOf(balanceAmount), payAmount); 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.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); 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())) if (ObjectUtil.isNotEmpty(oilOrder.getStaffId()))
staffCommissionService.countStaffCommission(oilOrder.getStaffId(), oilOrder.getStoreId(), oilOrder.getOrderAmount(), oilOrder.getOrderAmount(), "1", orderNo); staffCommissionService.countStaffCommission(oilOrder.getStaffId(), oilOrder.getStoreId(), oilOrder.getOrderAmount(), oilOrder.getOrderAmount(), "1", orderNo);
oilOrder.setPayAmount(payAmount); oilOrder.setPayAmount(payAmount);
@ -1796,8 +1814,6 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
this.updateGrowthValue(oilOrder.getOrderAmount(), oilOrder.getPayAmount(), userId, Integer.valueOf(oilOrder.getOils()), oilOrder.getStoreId(), orderNo); this.updateGrowthValue(oilOrder.getOrderAmount(), oilOrder.getPayAmount(), userId, Integer.valueOf(oilOrder.getOils()), oilOrder.getStoreId(), orderNo);
this.addOilTracks(oilOrder, oilOrder.getStoreId()); this.addOilTracks(oilOrder, oilOrder.getStoreId());
this.updateCardAndActiveById(oilOrder.getStoreId(), oilOrder.getUserId(), oilOrder.getId()); 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())) { if (ObjectUtil.isNotEmpty(oilOrder.getStaffId())) {
staffCommissionService.countStaffCommission(oilOrder.getStaffId(), oilOrder.getStoreId(), oilOrder.getOrderAmount(), oilOrder.getPayAmount(), "1", orderNo); staffCommissionService.countStaffCommission(oilOrder.getStaffId(), oilOrder.getStoreId(), oilOrder.getOrderAmount(), oilOrder.getPayAmount(), "1", orderNo);
} }
@ -1891,6 +1907,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
if (oilName.getOilType().equals("天然气")) { if (oilName.getOilType().equals("天然气")) {
userBalanceService.growthValue(userid, store.getChainStoreId(), storeId, "3", oilAmount, "油品订单消费", orderNo); userBalanceService.growthValue(userid, store.getChainStoreId(), storeId, "3", oilAmount, "油品订单消费", orderNo);
} }
} }
} }
@ -2259,7 +2276,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
staffCommissionService.countStaffCommission(nowAccountInfo.getStaffId(), nowAccountInfo.getStoreId(), oilOrderVo.getOrderAmount(), oilOrderVo.getPayAmount(), "1", orderNo); staffCommissionService.countStaffCommission(nowAccountInfo.getStaffId(), nowAccountInfo.getStoreId(), oilOrderVo.getOrderAmount(), oilOrderVo.getPayAmount(), "1", orderNo);
this.addOilTracks(oilOrderVo, nowAccountInfo.getStoreId()); this.addOilTracks(oilOrderVo, nowAccountInfo.getStoreId());
this.updateCardAndActiveById(nowAccountInfo.getStoreId(), oilOrderVo.getUserId(), oilOrderVo.getId()); 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()); this.insertFavorable(oilOrderVo, oilOrderVo.getOilCardAmount1());
if (ObjectUtil.isNotEmpty(oilOrderVo.getUserId())) integralSettingsService.refuelPoints(oilOrderVo); if (ObjectUtil.isNotEmpty(oilOrderVo.getUserId())) integralSettingsService.refuelPoints(oilOrderVo);
//修改优惠券使用状态 //修改优惠券使用状态

View File

@ -19,4 +19,13 @@ public interface IMtUserFuelService extends IService<MtUserFuel> {
* @return * @return
*/ */
Double selectByUserIdAndOilId(Integer userId, Integer oilId, Integer storeId); 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);
} }

View File

@ -2,10 +2,15 @@ package com.fuint.business.userManager.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.entity.MtUserFuel;
import com.fuint.business.userManager.mapper.MtUserFuelMapper; import com.fuint.business.userManager.mapper.MtUserFuelMapper;
import com.fuint.business.userManager.service.IMtUserFuelService; import com.fuint.business.userManager.service.IMtUserFuelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -18,6 +23,10 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class MtUserFuelServiceImpl extends ServiceImpl<MtUserFuelMapper, MtUserFuel> implements IMtUserFuelService { public class MtUserFuelServiceImpl extends ServiceImpl<MtUserFuelMapper, MtUserFuel> implements IMtUserFuelService {
@Autowired
private CardFuelChangeService cardFuelChangeService;
@Autowired
private OilNameService oilNameService;
@Override @Override
public Double selectByUserIdAndOilId(Integer userId, Integer oilId, Integer storeId) { public Double selectByUserIdAndOilId(Integer userId, Integer oilId, Integer storeId) {
@ -30,4 +39,29 @@ public class MtUserFuelServiceImpl extends ServiceImpl<MtUserFuelMapper, MtUserF
if (ObjectUtil.isNotEmpty(mtUserFuel) && ObjectUtil.isNotEmpty(mtUserFuel.getFuelAmount())) fuelAmount = mtUserFuel.getFuelAmount(); if (ObjectUtil.isNotEmpty(mtUserFuel) && ObjectUtil.isNotEmpty(mtUserFuel.getFuelAmount())) fuelAmount = mtUserFuel.getFuelAmount();
return fuelAmount; return fuelAmount;
} }
@Override
public void changeBalance(Integer userId, Integer oilId, Integer storeId, Integer chainStoreId, Double balance,String orderNo) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("mt_user_id", userId);
queryWrapper.eq("oil_name", oilId);
queryWrapper.eq("store_id", storeId);
MtUserFuel mtUserFuel = baseMapper.selectOne(queryWrapper);
Double fuelAmount = mtUserFuel.getFuelAmount();
mtUserFuel.setFuelAmount(fuelAmount - balance);
baseMapper.updateById(mtUserFuel);
OilName oilName = oilNameService.selectOilNameById(oilId);
CardFuelChange cardFuelChange = new CardFuelChange();
cardFuelChange.setUserId(userId);
cardFuelChange.setChainStoreId(chainStoreId);
cardFuelChange.setStoreId(storeId);
cardFuelChange.setChangeType("0");
cardFuelChange.setFromType("油卡消费");
cardFuelChange.setBalance(balance);
cardFuelChange.setOilType(String.valueOf(oilId));
cardFuelChange.setType(oilName.getOilType() + " " + oilName.getOilName());
cardFuelChange.setOrderNo(orderNo);
cardFuelChange.setAfterTheChange(mtUserFuel.getFuelAmount());
cardFuelChangeService.insert(cardFuelChange);
}
} }

View File

@ -1596,6 +1596,7 @@ export default {
this.payForm.oilOrder = null this.payForm.oilOrder = null
} }
this.payForm.oilCardAmount = this.oilLiter
// //
this.payForm.goodsOrder = JSON.stringify(this.goodsList) this.payForm.goodsOrder = JSON.stringify(this.goodsList)
// //