This commit is contained in:
cun-nan 2024-02-02 14:18:16 +08:00
parent d463a82cd6
commit 974fd2be7c
14 changed files with 353 additions and 177 deletions

View File

@ -70,3 +70,12 @@ export function allAmountCommissionRecord(query) {
params: query
})
}
// 查询员工提成记录
export function listStaffCommissionRecord(query) {
return request({
url: '/commissionRecord/queryList',
method: 'get',
params: query
})
}

View File

@ -18,22 +18,6 @@
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.mobile }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="订单类型">
<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>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
@ -70,58 +54,43 @@
<!-- </div>-->
<!-- </el-card>-->
<!-- <div style="margin-top: 20px" v-if="activeName=='staffCommission'">-->
<!-- <el-table ref="tables" v-loading="loading" :data="staffCommissionList">-->
<!-- <el-table-column type="index" width="80" align="center" label="序号"/>-->
<!-- <el-table-column label="员工信息" align="center">-->
<!-- <el-table-column label="姓名" prop="realName" align="center"/>-->
<!-- <el-table-column label="手机号" prop="mobile" align="center"/>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="提成类型" align="center" >-->
<!-- <el-table-column label="油卡充值" prop="realName" align="center"/>-->
<!-- <el-table-column label="囤油卡充值" prop="mobile" align="center"/>-->
<!-- <el-table-column label="车主加油" prop="mobile" align="center"/>-->
<!-- <el-table-column label="非油品" prop="mobile" align="center"/>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="汇总" prop="amount" align="center" width="260"/>-->
<!-- <el-table-column label="详情" prop="createTime" align="center" width="160">-->
<!-- <template slot-scope="scope">-->
<!-- <span>查看详情</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- <pagination-->
<!-- v-show="total1>0"-->
<!-- :total="total1"-->
<!-- :page.sync="queryParams1.page"-->
<!-- :limit.sync="queryParams1.pageSize"-->
<!-- @pagination="getCommissionList"-->
<!-- />-->
<!-- </div>-->
<div style="margin-top: 20px" v-if="activeName=='staffCommission'">
<el-table ref="tables" v-loading="loading" :data="commissionList">
<el-table ref="tables" v-loading="loading" :data="staffCommissionList">
<el-table-column type="index" width="80" align="center" label="序号"/>
<el-table-column label="员工信息" align="center">
<el-table-column label="姓名" prop="realName" align="center"/>
<el-table-column label="手机号" prop="mobile" align="center"/>
<el-table-column label="姓名" prop="staffName" align="center"/>
<el-table-column label="手机号" prop="staffMobile" align="center"/>
</el-table-column>
<el-table-column label="类型" prop="type" align="center" >
<el-table-column label="提成类型" align="center" >
<el-table-column label="油卡充值" prop="oilCardRecharge" align="center">
<template slot-scope="scope">
<span>{{ scope.row.oilCardRecharge || 0 }}</span>
</template>
</el-table-column>
<el-table-column label="囤油卡充值" prop="oilStorageRecharge" align="center">
<template slot-scope="scope">
<span>{{ scope.row.oilCardRecharge || 0 }}</span>
</template>
</el-table-column>
<el-table-column label="车主加油" prop="oilSale" align="center">
<template slot-scope="scope">
<span>{{ scope.row.oilSale || 0 }}</span>
</template>
</el-table-column>
<el-table-column label="非油品" prop="goodsCommission" align="center">
<template slot-scope="scope">
<span>{{ scope.row.goodsCommission || 0 }}</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="汇总" prop="summary" align="center" width="260">
<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>
<span>{{ scope.row.summary || 0 }}</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"/>
<el-table-column label="创建时间" prop="createTime" align="center" width="160">
<el-table-column label="详情" align="center" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
<el-button type="text" icon="el-icon-document" @click="lookDetail(scope.row.staffId)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
@ -131,9 +100,10 @@
:total="total1"
:page.sync="queryParams1.page"
:limit.sync="queryParams1.pageSize"
@pagination="getCommissionList"
@pagination="getStaffCommissionList"
/>
</div>
</el-tab-pane>
</el-tabs>
@ -236,11 +206,16 @@
<el-row>
<el-col :span="24" style="display: flex;margin-bottom: 10px">
<el-form-item label="提成来源" prop="commissionSource" style="width: 420px">
<el-radio-group v-model="form.commissionSource">
<el-radio-group v-model="form.commissionSource" v-if="form.commissionSource == '非油品'">
<!-- <el-radio v-for="dict in dict.type.source" @change="isChange" :label="dict.value">{{ dict.label }}</el-radio>-->
<el-radio v-if="form.commissionSource == '油品'" @change="isChange" label="油品" value="油品"></el-radio>
<el-radio v-if="form.commissionSource == '非油品'" @change="isChange" label="非油品" value="非油品"></el-radio>
</el-radio-group>
<el-radio-group v-model="form.commissionSource" v-else>
<!-- <el-radio v-for="dict in dict.type.source" @change="isChange" :label="dict.value">{{ dict.label }}</el-radio>-->
<el-radio @change="isChange" label="储值卡充值" value="储值卡充值"></el-radio>
<el-radio @change="isChange" label="囤油卡充值" value="囤油卡充值"></el-radio>
<el-radio @change="isChange" label="车主加油" value="车主加油"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
@ -267,12 +242,9 @@
<el-row>
<el-col :span="24">
<el-form-item label="提成类型" prop="type">
<el-radio-group v-model="form.type" v-if="form.commissionSource=='油品'">
<el-radio-group v-model="form.type">
<el-radio v-for="dict in dict.type.comissionType" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
<el-radio-group v-model="form.type" v-else>
<el-radio v-for="dict in dict.type.comissionType" :label="dict.value" v-if="dict.value!='refuleNum'">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
@ -324,6 +296,96 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-drawer
title="库存跟踪"
:visible.sync="drawer"
direction="rtl"
size="60%"
:before-close="handleClose">
<div style="display: grid; place-items: center;">
<el-card class="box-card">
<el-form :model="queryParams2" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="订单类型">
<el-select
v-model="queryParams2.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-option label="囤油卡充值提成" :value="6"></el-option>
</el-select>
</el-form-item>
<el-form-item label="订单号">
<el-input v-model="queryParams2.orderNo" placeholder="请输入订单号"></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
size="medium"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery1">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery1">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="box-card" style="margin-top: 15px">
<div style="margin-top: 20px" v-if="activeName=='staffCommission'">
<el-table ref="tables" v-loading="loading" :data="commissionList">
<el-table-column type="index" width="80" align="center" label="序号"/>
<!-- <el-table-column label="员工信息" align="center">-->
<!-- <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" >
<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>
<span v-if="scope.row.type==6">囤油卡充值提成</span>
</template>
</el-table-column>
<el-table-column label="提成金额(元)" prop="amount" align="center">
<template slot-scope="scope">
<span>{{ scope.row.amount || 0 }}</span>
</template>
</el-table-column>
<el-table-column label="关联订单号" prop="orderNo" align="center" width="260"/>
<el-table-column label="描述" prop="description" align="center"/>
<el-table-column label="创建时间" prop="createTime" align="center" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total2>0"
:total="total2"
:page.sync="queryParams2.page"
:limit.sync="queryParams2.pageSize"
@pagination="getCommissionList"
/>
</div>
</el-card>
</div>
</el-drawer>
</div>
</template>
@ -333,7 +395,7 @@
import {
addCommission, allAmountCommissionRecord, delCommission,
getCommission,
listCommission, listCommissionRecord,
listCommission, listCommissionRecord, listStaffCommissionRecord,
queryCommission,
updateCommission
} from "@/api/staffCommission/staffcommission";
@ -357,6 +419,7 @@ export default {
//
total: 0,
total1: 0,
total2: 0,
//
list: [],
commissionList: [],
@ -377,6 +440,12 @@ export default {
page: 1,
pageSize: 10,
},
queryParams2: {
page: 1,
pageSize: 10,
},
//
drawer: false,
staffList:[],
//
dateRange: [],
@ -424,6 +493,14 @@ export default {
this.getDuty();
},
methods:{
getStaffCommissionList(){
this.loading = true
listStaffCommissionRecord(this.addDateRange(this.queryParams1, this.dateRange)).then(res => {
this.staffCommissionList = res.data.records;
this.total1 = res.data.total;
this.loading = false
})
},
getStaffDuty(list,ids){
let id = ids.split(",")
let name = ""
@ -449,6 +526,10 @@ export default {
this.roleList = response.data
})
},
//
handleClose(done) {
done();
},
//
handleClick(tab, event) {
if (this.activeName == 'oil'){
@ -476,10 +557,15 @@ export default {
page: 1,
pageSize: 10,
};
this.getCommissionList();
this.getStaffCommissionList();
}
},
//
lookDetail(staffId){
this.drawer = true
this.queryParams2.staffId = staffId
this.getCommissionList()
},
getCheckbox(){
console.log(this.staffRoleGroup)
// this.form.commissionSource = this.commissionSource.toString()
@ -497,16 +583,16 @@ export default {
//
getCommissionList(){
this.loading = true;
listCommissionRecord(this.addDateRange(this.queryParams1, this.dateRange)).then(res => {
listCommissionRecord(this.addDateRange(this.queryParams2, this.dateRange)).then(res => {
this.commissionList = res.data.records;
this.total1 = res.data.total;
this.total2 = res.data.total;
this.loading = false;
})
allAmountCommissionRecord(this.addDateRange(this.queryParams1, this.dateRange)).then(res => {
if (res.data){
this.allAmount = res.data
}
})
// allAmountCommissionRecord(this.addDateRange(this.queryParams1, this.dateRange)).then(res => {
// if (res.data){
// this.allAmount = res.data
// }
// })
},
//
reset() {
@ -551,6 +637,11 @@ export default {
//
handleQuery() {
this.queryParams1.page = 1;
this.getStaffCommissionList();
},
//
handleQuery1() {
this.queryParams1.page = 1;
this.getCommissionList();
},
@ -564,6 +655,16 @@ export default {
// this.resetForm("queryForm");
this.handleQuery();
},
//
resetQuery1() {
this.dateRange = [];
this.queryParams2 = {
page: 1,
pageSize: 10,
}
// this.resetForm("queryForm");
this.handleQuery1();
},
//
handleDelete(row) {
const name = row.name

View File

@ -185,7 +185,7 @@ public class FyPayServiceImpl implements FyPayService {
oilOrder.setOrderStatus("paid");
oilOrder.setPayTime(date);
oilOrderService.updateCardAndActiveById(oilOrder.getStoreId(),oilOrder.getUserId(),oilOrder.getActiveId(),oilOrder.getCouponId(),oilOrder.getActiveType(),oilOrder.getOrderAmount(), Integer.valueOf(oilOrder.getOils()));
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"1",orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),"1",orderNo);
// 修改油罐容量
List<JSONObject> jsonObjects = JSONArray.parseArray(map1.get("oilOrder"), JSONObject.class);
if (jsonObjects.size()<=1) {
@ -211,7 +211,7 @@ public class FyPayServiceImpl implements FyPayService {
if (goodsOrder.getUserId()!=null){
isMember = true;
}
staffCommissionService.countStaffCommission(goodsOrder.getStaffId(),goodsOrder.getStoreId(),goodsOrder.getAmount(),goodsOrder.getPayAmount(),0.0,"2",orderNo);
staffCommissionService.countStaffCommission(goodsOrder.getStaffId(),goodsOrder.getStoreId(),goodsOrder.getAmount(),goodsOrder.getPayAmount(),"2",orderNo);
if (!map1.get("goodsOrder").equals("[]")){
List<JSONObject> goods = JSONArray.parseArray(map1.get("goodsOrder"), JSONObject.class);
OrderGoods orderGoods = new OrderGoods();
@ -248,7 +248,7 @@ public class FyPayServiceImpl implements FyPayService {
}
for (OilOrder order : list) {
if (order.getOrderType().equals("主订单")){
staffCommissionService.countStaffCommission(order.getStaffId(),order.getStoreId(),order.getOrderAmount(),order.getPayAmount(),oilLiters,"1",orderNo);
staffCommissionService.countStaffCommission(order.getStaffId(),order.getStoreId(),order.getOrderAmount(),order.getPayAmount(),"1",orderNo);
}
// 添加多个油品订单
order.setOrderStatus("paid");

View File

@ -12,6 +12,7 @@ import io.lettuce.core.dynamic.annotation.Param;
import javax.annotation.Resource;
import java.util.Map;
/**
* 提成记录表(CommissionRecord)表控制层
@ -44,6 +45,22 @@ public class CommissionRecordController extends BaseController {
return getSuccessResult(iPageList);
}
/**
* 分页查询
*
* @param commissionRecord 筛选条件
* @param pageNo 分页对象
* @return 查询结果
*/
@GetMapping("queryList")
public ResponseObject queryStaffCommission(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
CommissionRecord commissionRecord) {
Page page = new Page(pageNo, pageSize);
Map<String, Object> map = commissionRecordService.selectStaffCommissionList(page, commissionRecord);
return getSuccessResult(map);
}
/**

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.vo.CommissionRecordVo;
import com.fuint.business.commission.vo.StaffPercentageVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@ -97,5 +98,12 @@ public interface CommissionRecordMapper extends BaseMapper<CommissionRecord> {
* @return
*/
Double selectAllAmount(@Param("commissionRecord") CommissionRecordVo commissionRecord);
/**
* 根据条件查询员工提成总金额
* @param commissionRecord
* @return
*/
Double selectAllCommissIon(@Param("commission") CommissionRecord commissionRecord);
}

View File

@ -233,5 +233,29 @@
</if>
</where>
</select>
<select id="selectAllCommissIon" resultType="java.lang.Double"
parameterType="com.fuint.business.commission.entity.CommissionRecord">
select sum(amount) from commission_record
<where>
<if test="commission.storeId != null and commission.storeId != ''">
and store_id = #{commission.storeId}
</if>
<if test="commission.staffId != null and commission.staffId != ''">
and staff_id = #{commission.staffId}
</if>
<if test="commission.type != null and commission.type != ''">
and type = #{commission.type}
</if>
<if test="commission.orderNo != null and commission.orderNo != ''">
and order_no like concat('%', #{commission.orderNo}, '%')
</if>
<if test="commission.params.beginTime != null and commission.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{commission.params.beginTime},'%y%m%d')
</if>
<if test="commission.params.endTime != null and commission.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{commission.params.endTime},'%y%m%d')
</if>
</where>
</select>
</mapper>

View File

@ -9,7 +9,12 @@
<include refid="selectCommission"></include>
<where>
sc.store_id = #{commission.storeId}
and sc.commission_source = #{commission.commissionSource}
<if test="commission.commissionSource == '油品'">
and sc.commission_source != #{commission.commissionSource} and sc.commission_source != '非油品'
</if>
<if test="commission.commissionSource == '非油品'">
and sc.commission_source = #{commission.commissionSource}
</if>
</where>
</select>
</mapper>

View File

@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.vo.CommissionRecordVo;
import com.fuint.business.commission.vo.StaffPercentageVo;
import io.lettuce.core.dynamic.annotation.Param;
import java.util.Map;
/**
* 提成记录表(CommissionRecord)表服务接口
@ -32,6 +35,13 @@ public interface CommissionRecordService {
*/
IPage<CommissionRecord> queryByPage(@Param("page") Page page, CommissionRecord commissionRecord);
/**
* 根据条件分页查询员工提成方案信息
* @param page
* @return
*/
public Map<String,Object> selectStaffCommissionList(Page page, CommissionRecord commissionRecord);
/**
* 新增数据
*

View File

@ -60,9 +60,8 @@ public interface StaffCommissionService extends IService<StaffCommission> {
* @param storeId 店铺id
* @param amount 订单金额
* @param payAmount 实付金额
* @param oilLiters 油品消费升数
* @param type 订单类型1.油品2.非油品3.储值卡4.囤油卡5.礼品卡6.加油
* @param type 订单类型1.车主加油2.非油品3.储值卡充值4.囤油卡充值
* @param orderNo 关联订单号
*/
void countStaffCommission(Integer staffId,Integer storeId,Double amount,Double payAmount,Double oilLiters,String type,String orderNo);
void countStaffCommission(Integer staffId,Integer storeId,Double amount,Double payAmount,String type,String orderNo);
}

View File

@ -8,6 +8,10 @@ import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.mapper.CommissionRecordMapper;
import com.fuint.business.commission.service.CommissionRecordService;
import com.fuint.business.commission.vo.CommissionRecordVo;
import com.fuint.business.commission.vo.StaffPercentageVo;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil;
import io.lettuce.core.dynamic.annotation.Param;
@ -16,6 +20,10 @@ import com.fuint.common.dto.AccountInfo;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 提成记录表(CommissionRecord)表服务实现类
@ -27,6 +35,8 @@ import javax.annotation.Resource;
public class CommissionRecordServiceImpl implements CommissionRecordService {
@Resource
private CommissionRecordMapper commissionRecordMapper;
@Autowired
private ILJStaffService staffService;
/**
* 通过ID查询单条数据
@ -53,6 +63,43 @@ public class CommissionRecordServiceImpl implements CommissionRecordService {
return this.commissionRecordMapper.queryAllByLimit(page, commissionRecord);
}
@Override
public Map<String,Object> selectStaffCommissionList(Page page, CommissionRecord commissionRecord) {
Map<String,Object> resMap = new HashMap<>();
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LJStaff staff = new LJStaff();
staff.setStoreId(nowAccountInfo.getStoreId());
staff.setId(commissionRecord.getStaffId());
IPage<LJStaff> ljStaffIPage = staffService.selectStaffList(page, staff);
if (ObjectUtil.isNotEmpty(ljStaffIPage)){
List<StaffPercentageVo> list = new ArrayList<>();
for (LJStaff record : ljStaffIPage.getRecords()) {
StaffPercentageVo staffPercentageVo = new StaffPercentageVo();
staffPercentageVo.setStoreId(nowAccountInfo.getStoreId());
staffPercentageVo.setStaffName(record.getRealName());
staffPercentageVo.setStaffMobile(record.getMobile());
staffPercentageVo.setStaffId(record.getId());
commissionRecord.setStoreId(nowAccountInfo.getStoreId());
commissionRecord.setStaffId(record.getId());
commissionRecord.setType("");
staffPercentageVo.setSummary(commissionRecordMapper.selectAllCommissIon(commissionRecord));
commissionRecord.setType("1");
staffPercentageVo.setOilSale(commissionRecordMapper.selectAllCommissIon(commissionRecord));
commissionRecord.setType("2");
staffPercentageVo.setGoodsCommission(commissionRecordMapper.selectAllCommissIon(commissionRecord));
commissionRecord.setType("3");
staffPercentageVo.setOilCardRecharge(commissionRecordMapper.selectAllCommissIon(commissionRecord));
commissionRecord.setType("6");
staffPercentageVo.setOilStorageRecharge(commissionRecordMapper.selectAllCommissIon(commissionRecord));
list.add(staffPercentageVo);
}
resMap.put("records",list);
resMap.put("total",ljStaffIPage.getTotal());
}
return resMap;
}
/**
* 新增数据
*

View File

@ -115,7 +115,7 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
private ILJStaffService staffService;
@Override
public void countStaffCommission(Integer staffId,Integer storeId,Double amount,Double payAmount,Double oilLiters,String type,String orderNo) {
public void countStaffCommission(Integer staffId,Integer storeId,Double amount,Double payAmount,String type,String orderNo) {
LJStaff staff = staffService.selectStaffById(staffId);
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id",storeId);
@ -126,7 +126,7 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
for (StaffCommission staffCommission : list) {
CommissionRecord commissionRecord = new CommissionRecord();
String[] staffRoleGroups = staffCommission.getStaffRoleGroup().split(",");
if (type.equals("1") && staffCommission.getCommissionSource().equals("")){
if (type.equals("1") && staffCommission.getCommissionSource().equals("车主加")){
for (String staffRoleGroup : staffRoleGroups) {
if (staff.getRoleId().equals(staffRoleGroup)){
commissionRecord.setStaffId(staffId);
@ -161,17 +161,17 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
}
}
// 按照加油数量计算提成
if (staffCommission.getType().equals("refuleNum")){
if (oilLiters>=Double.valueOf(staffCommission.getMeetCondition())){
if (unit.equals("")){
commissionRecord.setAmount(royaltyRate);
}
if (unit.equals("%")){
commissionRecord.setAmount(oilLiters*(royaltyRate/100));
}
commissionRecordService.insertRecord(commissionRecord);
}
}
// if (staffCommission.getType().equals("refuleNum")){
// if (oilLiters>=Double.valueOf(staffCommission.getMeetCondition())){
// if (unit.equals("")){
// commissionRecord.setAmount(royaltyRate);
// }
// if (unit.equals("%")){
// commissionRecord.setAmount(oilLiters*(royaltyRate/100));
// }
// commissionRecordService.insertRecord(commissionRecord);
// }
// }
}
}
}
@ -211,7 +211,7 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
}
}
}
if (type.equals("3") && staffCommission.getCommissionSource().equals("储值卡")){
if (type.equals("3") && staffCommission.getCommissionSource().equals("储值卡充值")){
for (String staffRoleGroup : staffRoleGroups) {
if (staff.getRoleId().equals(staffRoleGroup)) {
commissionRecord.setStaffId(staffId);
@ -247,79 +247,7 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
}
}
}
if (type.equals("4") && staffCommission.getCommissionSource().equals("囤油卡")){
for (String staffRoleGroup : staffRoleGroups) {
if (staff.getRoleId().equals(staffRoleGroup)) {
commissionRecord.setStaffId(staffId);
commissionRecord.setStoreId(storeId);
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);
// 按照订单金额计算提成
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);
}
}
}
if (type.equals("5") && staffCommission.getCommissionSource().equals("礼品卡")){
for (String staffRoleGroup : staffRoleGroups) {
if (staff.getRoleId().equals(staffRoleGroup)) {
commissionRecord.setStaffId(staffId);
commissionRecord.setStoreId(storeId);
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);
// 按照订单金额计算提成
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);
}
}
}
if (type.equals("6") && staffCommission.getCommissionSource().equals("加油")){
if (type.equals("4") && staffCommission.getCommissionSource().equals("囤油卡充值")){
for (String staffRoleGroup : staffRoleGroups) {
if (staff.getRoleId().equals(staffRoleGroup)) {
commissionRecord.setStaffId(staffId);

View File

@ -0,0 +1,25 @@
package com.fuint.business.commission.vo;
import lombok.Data;
@Data
public class StaffPercentageVo {
// 店铺id
private Integer storeId;
// 员工id
private Integer staffId;
// 员工名称
private String staffName;
// 员工手机号
private String staffMobile;
// 员工油卡充值提成
private Double oilCardRecharge;
// 员工囤油卡充值提成
private Double oilStorageRecharge;
// 员工油品出售提成车主加油
private Double oilSale;
// 员工非油品出售提成
private Double goodsCommission;
// 员工提成汇总
private Double summary;
}

View File

@ -18,6 +18,9 @@
<if test="staff.status != null and staff.status != ''">
and status = #{staff.status}
</if>
<if test="staff.id != null and staff.id != ''">
and id = #{staff.id}
</if>
</where>
</select>

View File

@ -301,7 +301,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,"2",orderNo);
staffCommissionService.countStaffCommission(staffId,storeId,goodsAmount,goodsActualPay,"2",orderNo);
ljOrder.setPayTime(new Date());
}
// 将商品订单的json数据转换为数组
@ -352,7 +352,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
order.setOrderNo(orderNo);
order.setDiscountAmount(oilDiscount);
if (payType.equals("CASH")){
staffCommissionService.countStaffCommission(staffId,storeId,oilAmount,oilActualPay,oilLiters,"1",orderNo);
staffCommissionService.countStaffCommission(staffId,storeId,oilAmount,oilActualPay,"1",orderNo);
}
order.setCouponId(cardFavorableId);
}else {
@ -750,7 +750,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cashierOrder.setPayType(map.get("payType"));
cashierOrderService.insertCashierOrder(cashierOrder);
this.insertAllOrderInfo(orderNo, storeId, oilAmount, oilAmount, map.get("payType"), userId, "PC", "1", status);
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")),storeId,oilAmount,oilAmount,oilLiters,"1",orderNo);
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")),storeId,oilAmount,oilAmount,"1",orderNo);
res.put("success","success");
}
}
@ -815,7 +815,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cashierOrderService.insertCashierOrder(cashierOrder);
this.updateGrowthValue1(oilAmount,oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo);
this.insertAllOrderInfo(orderNo,accountInfo.getStoreId(),oilAmount,oilAmount,map.get("payType"),userId,"PC","1","paid");
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")),storeId,oilAmount,oilAmount,oilLiters,"1",orderNo);
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")),storeId,oilAmount,oilAmount,"1",orderNo);
// this.insertCardBalance(oilAmount,userId,storeId);
res.put("success","success");
}else {
@ -1124,7 +1124,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
this.insertCardOrder(oilOrder.getUserId(),oilOrder.getStoreId(),orderNo,oilOrder.getOrderAmount(),"paid", Double.valueOf(balanceAmount),payAmount);
this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(),payAmount,oilOrder.getPayType(),oilOrder.getUserId(),"applet","1","paid");
this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId(),orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getOrderAmount(),oilOrder.getOilNum(),"1",orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getOrderAmount(),"1",orderNo);
oilOrder.setPayAmount(payAmount);
oilOrder.setDiscountAmount(Double.valueOf(discountAmount));
oilOrder.setPayTime(new Date());
@ -1209,7 +1209,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
this.addOilTracks(oilOrder,oilOrder.getStoreId());
this.updateCardAndActiveById(oilOrder.getStoreId(),oilOrder.getUserId(),oilOrder.getActiveId(),oilOrder.getCouponId(),oilOrder.getActiveType(),oilOrder.getOrderAmount(), Integer.valueOf(oilOrder.getOils()));
this.insertCardBalance(oilOrder.getOrderAmount()-oilOrder.getDiscountAmount()-oilOrder.getPayAmount(),userId,oilOrder.getStoreId(),orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"1",orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),"1",orderNo);
}
row = baseMapper.updateById(oilOrder);
}