This commit is contained in:
cun-nan 2024-01-18 10:56:43 +08:00
parent 46913be03f
commit d8023ecfba
10 changed files with 132 additions and 21 deletions

View File

@ -60,6 +60,13 @@
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<el-table-column label="ID" align="center" prop="id" width="80" />
<el-table-column label="姓名" align="center" prop="realName" />
<el-table-column label="员工角色" align="center" prop="roleId" >
<template slot-scope="scope">
<span v-if="scope.row.roleId=='12'">油站站长</span>
<span v-if="scope.row.roleId=='15'">普通员工</span>
<span v-if="scope.row.roleId=='16'">收银员</span>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" width="110"/>
<el-table-column label="员工码" align="center" prop="staffCode">
@ -175,7 +182,7 @@
</el-col>
<el-col :span="22" style="display: flex;margin-bottom: 10px">
<el-checkbox-group v-model="form.auditPrem" @change="getCheckbox">
<el-checkbox-group v-model="auditPrem" @change="getCheckbox">
<el-checkbox
v-for="dict in dict.type.shqx"
:key="dict.value"
@ -510,9 +517,9 @@ export default {
this.form.appletPrem = JSON.stringify(data);
},
getCheckbox(){
this.form.writeOff = this.writeOff.toString();
this.form.specialPrem = this.specialPrem.toString();
this.form.auditPrem = this.form.auditPrem.toString();
// this.form.writeOff = this.writeOff.toString();
// this.form.specialPrem = this.specialPrem.toString();
this.form.auditPrem = this.auditPrem.toString();
},
//
toTarget(url) {

View File

@ -20,7 +20,17 @@
</el-select>
</el-form-item>
<el-form-item label="订单类型">
<el-input v-model="queryParams1.type" placeholder="请输入订单类型"></el-input>
<el-select
v-model="queryParams1.type"
clearable
placeholder="全部"
>
<el-option label="油品订单出售" :value="1"></el-option>
<el-option label="商品订单出售" :value="2"></el-option>
<el-option label="储值卡充值" :value="3"></el-option>
<el-option label="油品退款" :value="4"></el-option>
<el-option label="商品退款" :value="5"></el-option>
</el-select>
</el-form-item>
<el-form-item label="订单号">
<el-input v-model="queryParams1.orderNo" placeholder="请输入订单号"></el-input>
@ -65,7 +75,15 @@
<el-table-column label="姓名" prop="realName" align="center"/>
<el-table-column label="手机号" prop="mobile" align="center"/>
</el-table-column>
<el-table-column label="类型" prop="type" align="center" />
<el-table-column label="类型" prop="type" align="center" >
<template slot-scope="scope">
<span v-if="scope.row.type==1">油品订单出售</span>
<span v-if="scope.row.type==2">商品订单出售</span>
<span v-if="scope.row.type==3">储值卡充值</span>
<span v-if="scope.row.type==4">油品退款</span>
<span v-if="scope.row.type==5">商品退款</span>
</template>
</el-table-column>
<el-table-column label="提成金额(元)" prop="amount" align="center" width="260"/>
<el-table-column label="关联订单号" prop="orderNo" align="center"/>
<el-table-column label="描述" prop="description" align="center"/>
@ -238,7 +256,7 @@
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="油品提成" prop="royaltyRate">
<el-form-item label="提成金额" prop="royaltyRate">
<el-input v-model="form.royaltyRate" placeholder="请输入提成">
<el-select v-model="select" style="width: 70px" slot="append" placeholder="请选择">
<el-option label="元" value="元"></el-option>

View File

@ -175,7 +175,7 @@ public class FyPayServiceImpl implements FyPayService {
// 油品订单
oilOrder.setOrderStatus("paid");
oilOrder.setPayTime(date);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"油品",orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"1",orderNo);
// 修改油罐容量
List<JSONObject> jsonObjects = JSONArray.parseArray(map1.get("oilOrder"), JSONObject.class);
if (jsonObjects.size()<=1) {
@ -197,7 +197,7 @@ public class FyPayServiceImpl implements FyPayService {
// 商品订单
goodsOrder.setStatus("paid");
goodsOrder.setPayTime(date);
staffCommissionService.countStaffCommission(goodsOrder.getStaffId(),goodsOrder.getStoreId(),goodsOrder.getAmount(),goodsOrder.getPayAmount(),0.0,"商品",orderNo);
staffCommissionService.countStaffCommission(goodsOrder.getStaffId(),goodsOrder.getStoreId(),goodsOrder.getAmount(),goodsOrder.getPayAmount(),0.0,"2",orderNo);
if (!map1.get("goodsOrder").equals("[]")){
List<JSONObject> goods = JSONArray.parseArray(map1.get("goodsOrder"), JSONObject.class);
OrderGoods orderGoods = new OrderGoods();
@ -228,9 +228,13 @@ public class FyPayServiceImpl implements FyPayService {
}
if (!ArrayUtil.isEmpty(list)){
if (list.size()>1){
Double oilLiters = 0.0;
for (OilOrder order : list){
oilLiters += order.getOilNum();
}
for (OilOrder order : list) {
if (order.getOrderType().equals("主订单")){
staffCommissionService.countStaffCommission(order.getStaffId(),order.getStoreId(),order.getOrderAmount(),order.getPayAmount(),order.getOilNum(),"油品",orderNo);
staffCommissionService.countStaffCommission(order.getStaffId(),order.getStoreId(),order.getOrderAmount(),order.getPayAmount(),oilLiters,"1",orderNo);
}
// 添加多个油品订单
order.setOrderStatus("paid");

View File

@ -39,7 +39,7 @@ public class CommissionRecord extends BaseEntity {
@ApiModelProperty("员工id")
private Integer staffId;
/**
* 类型
* 类型 1.油品订单出售2.商品订单出售3.储值卡充值4.油品退款5.商品退款
*/
@ApiModelProperty("类型")
private String type;

View File

@ -1,5 +1,6 @@
package com.fuint.business.commission.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
@ -14,7 +15,7 @@ import java.util.List;
* @author wangh
* @since 2023-11-14 13:40:03
*/
public interface CommissionRecordMapper {
public interface CommissionRecordMapper extends BaseMapper<CommissionRecord> {
/**
* 通过ID查询单条数据

View File

@ -77,4 +77,13 @@ public interface CommissionRecordService {
* @return
*/
Double selectAllAmount(CommissionRecordVo commissionRecord);
/**
* 添加退款提成记录信息
* @param orderNo 订单号
* @param type 订单类型1油品2商品
* @param staffId 员工id
* @param storeId 店铺id
*/
void addRefundRecord(String orderNo,String type,Integer staffId,Integer storeId);
}

View File

@ -1,5 +1,7 @@
package com.fuint.business.commission.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
@ -112,4 +114,35 @@ public class CommissionRecordServiceImpl implements CommissionRecordService {
commissionRecord.setStoreId(nowAccountInfo.getStoreId());
return commissionRecordMapper.selectAllAmount(commissionRecord);
}
@Override
public void addRefundRecord(String orderNo, String type, Integer staffId, Integer storeId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("staff_id",staffId);
queryWrapper.eq("store_id",storeId);
queryWrapper.eq("type",type);
queryWrapper.eq("order_no",orderNo);
CommissionRecord commissionRecord = commissionRecordMapper.selectOne(queryWrapper);
if (ObjectUtil.isNotEmpty(commissionRecord)){
CommissionRecord record = new CommissionRecord();
if (type.equals("1")){
record.setType("4");
record.setStaffId(staffId);
record.setStoreId(storeId);
record.setDescription("油品退款订单");
record.setOrderNo(orderNo);
record.setAmount(-commissionRecord.getAmount());
commissionRecordMapper.insert(record);
}
if (type.equals("2")){
record.setType("5");
record.setStaffId(staffId);
record.setStoreId(storeId);
record.setDescription("商品退款订单");
record.setOrderNo(orderNo);
record.setAmount(-commissionRecord.getAmount());
commissionRecordMapper.insert(record);
}
}
}
}

View File

@ -110,11 +110,12 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
if (list.size()>0 && ObjectUtil.isNotEmpty(staff)){
for (StaffCommission staffCommission : list) {
CommissionRecord commissionRecord = new CommissionRecord();
if (type.equals(staffCommission.getCommissionSource()) && staff.getRoleId().equals(staffCommission.getStaffRoleGroup())){
if (type.equals("1") && staffCommission.getCommissionSource().equals("油品")
&& staff.getRoleId().equals(staffCommission.getStaffRoleGroup())){
commissionRecord.setStaffId(staffId);
commissionRecord.setStoreId(storeId);
commissionRecord.setType(type+"订单出售");
commissionRecord.setDescription(type+"订单出售提成");
commissionRecord.setType(type);
commissionRecord.setDescription(staffCommission.getCommissionSource()+"订单出售提成");
commissionRecord.setOrderNo(orderNo);
Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0,staffCommission.getRoyaltyRate().length()-1));
String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length()-1);
@ -153,6 +154,39 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
}
commissionRecordService.insertRecord(commissionRecord);
}
if (type.equals("2") && staffCommission.getCommissionSource().equals("非油品")
&& staff.getRoleId().equals(staffCommission.getStaffRoleGroup())){
commissionRecord.setStaffId(staffId);
commissionRecord.setStoreId(storeId);
commissionRecord.setType(staffCommission.getCommissionSource()+"订单出售");
commissionRecord.setDescription(staffCommission.getCommissionSource()+"订单出售提成");
commissionRecord.setOrderNo(orderNo);
Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0,staffCommission.getRoyaltyRate().length()-1));
String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length()-1);
// 按照订单金额计算提成
if (staffCommission.getType().equals("orderAmount")){
if (amount>=Double.valueOf(staffCommission.getMeetCondition())){
if (unit.equals("")){
commissionRecord.setAmount(royaltyRate);
}
if (unit.equals("%")){
commissionRecord.setAmount(amount*(royaltyRate/100));
}
}
}
// 按照实付金额计算提成
if (staffCommission.getType().equals("payAmount")){
if (payAmount>=Double.valueOf(staffCommission.getMeetCondition())){
if (unit.equals("")){
commissionRecord.setAmount(royaltyRate);
}
if (unit.equals("%")){
commissionRecord.setAmount(payAmount*(royaltyRate/100));
}
}
}
commissionRecordService.insertRecord(commissionRecord);
}
}
}
}

View File

@ -11,6 +11,7 @@ import com.fuint.api.fuyou.entity.Const;
import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.business.commission.service.CommissionRecordService;
import com.fuint.business.convenienceSore.dto.LJGoodsDto;
import com.fuint.business.convenienceSore.entity.StockStatistic;
import com.fuint.business.convenienceSore.entity.StockTrack;
@ -142,6 +143,8 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
OilOrderService oilOrderService;
@Resource
OilTrackingService oilTrackingService;
@Resource
CommissionRecordService commissionRecordService;
@Override
@Transactional
public int refund(Map<String, String> map) {
@ -209,9 +212,11 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
}
if (ObjectUtil.isNotEmpty(oilOrder)) {
disposeOil(oilOrder,map.get("refundOrderNo"));
commissionRecordService.addRefundRecord(oilOrder.getOrderNo(),"1",oilOrder.getStaffId(),oilOrder.getStoreId());
}
if (ObjectUtil.isNotEmpty(ljOrder)) {
disposeGoods(ljOrder,map.get("refundOrderNo"));
commissionRecordService.addRefundRecord(ljOrder.getOrderNo(),"2",ljOrder.getStaffId(),ljOrder.getStoreId());
}
if (flag) {

View File

@ -279,7 +279,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
ljOrder.setStaffId(staffId);
ljOrder.setStatus(payStatus);
if (payType.equals("CASH")){
staffCommissionService.countStaffCommission(staffId,storeId,goodsAmount,goodsActualPay,0.0,"商品",orderNo);
staffCommissionService.countStaffCommission(staffId,storeId,goodsAmount,goodsActualPay,0.0,"2",orderNo);
ljOrder.setPayTime(new Date());
}
// 将商品订单的json数据转换为数组
@ -329,7 +329,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
order.setPayAmount(oilActualPay);
order.setOrderNo(orderNo);
if (payType.equals("CASH")){
staffCommissionService.countStaffCommission(staffId,storeId,oilAmount,oilActualPay,oilLiters,"油品",orderNo);
staffCommissionService.countStaffCommission(staffId,storeId,oilAmount,oilActualPay,oilLiters,"1",orderNo);
}
}else {
order.setOrderType("子订单");
@ -653,7 +653,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cashierOrder.setPayType(map.get("payType"));
cashierOrderService.insertCashierOrder(cashierOrder);
this.insertAllOrderInfo(orderNo, storeId, oilAmount, map.get("payType"), userId, "PC", "1", status);
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")),storeId,oilAmount,oilAmount,oilLiters,"油品",orderNo);
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")),storeId,oilAmount,oilAmount,oilLiters,"1",orderNo);
res.put("success","success");
}
}
@ -718,7 +718,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
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");
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")),storeId,oilAmount,oilAmount,oilLiters,"油品",orderNo);
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")),storeId,oilAmount,oilAmount,oilLiters,"1",orderNo);
// this.insertCardBalance(oilAmount,userId,storeId);
res.put("success","success");
}else {
@ -1011,7 +1011,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
this.updateGrowthValue(payAmount,userId, Integer.valueOf(oilOrder.getOils()),oilCardAmount,oilOrder.getStoreId(),orderNo);
this.addOilTracks(oilOrder,oilOrder.getStoreId());
this.insertCardOrder(oilOrder.getUserId(),oilOrder.getStoreId(),orderNo,oilOrder.getOrderAmount(),"paid", Double.valueOf(balanceAmount),payAmount);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getOrderAmount(),oilOrder.getOilNum(),"油品",orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getOrderAmount(),oilOrder.getOilNum(),"1",orderNo);
oilOrder.setPayAmount(payAmount);
oilOrder.setDiscountAmount(Double.valueOf(discountAmount));
oilOrder.setPayTime(new Date());
@ -1082,7 +1082,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
this.updateGrowthValue(oilOrder.getPayAmount(),userId, Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId(),orderNo);
this.addOilTracks(oilOrder,oilOrder.getStoreId());
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"油品",orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"1",orderNo);
CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo);
if (ObjectUtil.isNotEmpty(cashierOrder)){
cashierOrder.setOilOrderId(oilOrder.getId());