更新10.9

This commit is contained in:
许允枞 2024-10-09 16:45:58 +08:00
parent ec52b4c8ca
commit 44fdcdf686
5 changed files with 350 additions and 210 deletions

View File

@ -64,6 +64,10 @@ public class CommissionRecord extends BaseEntity {
*/ */
@TableField(exist = false) @TableField(exist = false)
private String roleId; private String roleId;
/**
* 提成卡来源油品非油品
*/
private String commissionSource;
} }

View File

@ -109,5 +109,5 @@ public interface CommissionRecordService {
* @param orderNo 订单号 * @param orderNo 订单号
* @return * @return
*/ */
int addRecord(Integer storeId, String type,Integer staffId,Double amount,Double payAmount, String classify, String commissionSource,String orderNo); void addRecord(Integer orderId);
} }

View File

@ -16,7 +16,9 @@ import com.fuint.business.commission.vo.StaffPercentageVo;
import com.fuint.business.member.entity.LJStaff; import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.order.entity.AllOrderInfo; import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.entity.OilOrder;
import com.fuint.business.order.mapper.AllOrderInfoMapper; import com.fuint.business.order.mapper.AllOrderInfoMapper;
import com.fuint.business.order.mapper.OilOrderMapper;
import com.fuint.repository.mapper.NewMtStaffMapper; import com.fuint.repository.mapper.NewMtStaffMapper;
import com.fuint.repository.model.NewMtStaff; import com.fuint.repository.model.NewMtStaff;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -47,6 +49,8 @@ public class CommissionRecordServiceImpl implements CommissionRecordService {
private NewMtStaffMapper newMtStaffMapper; private NewMtStaffMapper newMtStaffMapper;
@Autowired @Autowired
private StaffCommissionMapper staffCommissionMapper; private StaffCommissionMapper staffCommissionMapper;
@Autowired
private OilOrderMapper oilOrderMapper;
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据
@ -220,7 +224,7 @@ public class CommissionRecordServiceImpl implements CommissionRecordService {
/** /**
* 添加提成记录信息 * 添加提成记录信息
* @param storeId 店铺id * @param storeId 店铺id
* @param type 类型1.油品订单出售2.商品订单出售3.储值卡充值4.油品退款5.商品退款6.囤油卡充值 * @param commission_source 类型1.油品订单出售2.商品订单出售3.储值卡充值4.油品退款5.商品退款6.囤油卡充值
* @param staffId 员工id * @param staffId 员工id
* @param amount 订单金额 * @param amount 订单金额
* @param payAmount 实际支付金额 * @param payAmount 实际支付金额
@ -230,7 +234,11 @@ public class CommissionRecordServiceImpl implements CommissionRecordService {
* @return * @return
*/ */
@Override @Override
public int addRecord(Integer storeId, String type,Integer staffId,Double amount,Double payAmount, String classify, String commissionSource,String orderNo) { public void addRecord(Integer orderId) {
//查询订单信息
AllOrderInfo allOrderInfo = allOrderInfoMapper.selectById(orderId);
Integer storeId = allOrderInfo.getStoreId();
Integer staffId = allOrderInfo.getStaffId();
//根据员工id查询用户角色 //根据员工id查询用户角色
NewMtStaff newMtStaff = newMtStaffMapper.selectById(staffId); NewMtStaff newMtStaff = newMtStaffMapper.selectById(staffId);
if (ObjectUtil.isNull(newMtStaff)) { if (ObjectUtil.isNull(newMtStaff)) {
@ -240,42 +248,158 @@ public class CommissionRecordServiceImpl implements CommissionRecordService {
//查询对应的提成策略 //查询对应的提成策略
List<StaffCommission> staffCommissions = staffCommissionMapper.selectList(new LambdaQueryWrapper<StaffCommission>() List<StaffCommission> staffCommissions = staffCommissionMapper.selectList(new LambdaQueryWrapper<StaffCommission>()
.eq(StaffCommission::getStoreId, storeId) .eq(StaffCommission::getStoreId, storeId)
.eq(StaffCommission::getClassify, classify)
.eq(StaffCommission::getStatus, "qy")); .eq(StaffCommission::getStatus, "qy"));
//判断是否是油品与商品混合订单
if (allOrderInfo.getType().equals("6")){
//查询油品订单信息
OilOrder oilOrder = oilOrderMapper.selectOne(new LambdaQueryWrapper<OilOrder>()
.eq(OilOrder::getOrderNo, allOrderInfo.getOrderNo()));
//查询策略
//油品策略
StaffCommission staffCommissionOil = new StaffCommission();
//商品策略
StaffCommission staffCommissionProduct = new StaffCommission();
for (StaffCommission staffCommission1 : staffCommissions) {
String[] split = staffCommission1.getStaffRoleGroup().split(",");
if (Arrays.asList(split).contains(roleId)){
if (staffCommission1.getClassify().equals("0")) {
staffCommissionOil = staffCommission1;
}else if (staffCommission1.getClassify().equals("1")) {
staffCommissionProduct = staffCommission1;
}
}
}
if (ObjectUtil.isNotEmpty(staffCommissionOil)) {
//添加油品提成记录表
CommissionRecord record = new CommissionRecord();
record.setStoreId(storeId);
record.setStaffId(staffId);
record.setOrderNo(allOrderInfo.getOrderNo());
record.setDescription("订单支付金额:" + oilOrder.getPayAmount());
record.setCreateTime(DateUtil.date());
record.setCommissionSource(staffCommissionOil.getCommissionSource());
record.setCreateBy(TokenUtil.getNowAccountInfo().getId().toString());
//计算油品提成金额
//判断提成类型
Double royaltyRate = Double.valueOf(staffCommissionOil.getRoyaltyRate().substring(0, staffCommissionOil.getRoyaltyRate().length() - 1));
String unit = staffCommissionOil.getRoyaltyRate().substring(staffCommissionOil.getRoyaltyRate().length() - 1);
//按照订单金额计算提成
if (staffCommissionOil.getType().equals("orderAmount")) {
compute(oilOrder.getOrderAmount(), staffCommissionOil, unit, record, royaltyRate);
}
//按照实付金额计算提成
else if (staffCommissionOil.getType().equals("payAmount")){
compute(oilOrder.getPayAmount(), staffCommissionOil, unit, record, royaltyRate);
}
oilOrder.setCommissionAmount(record.getAmount());
commissionRecordMapper.insert(record);
oilOrderMapper.updateById(oilOrder);
}
if (ObjectUtil.isNotEmpty(staffCommissionProduct)) {
//添加商品提成记录表
CommissionRecord commissionRecordProduct = new CommissionRecord();
commissionRecordProduct.setStoreId(storeId);
commissionRecordProduct.setStaffId(staffId);
commissionRecordProduct.setOrderNo(allOrderInfo.getOrderNo());
commissionRecordProduct.setCreateTime(DateUtil.date());
commissionRecordProduct.setCreateBy(TokenUtil.getNowAccountInfo().getId().toString());
commissionRecordProduct.setCommissionSource(staffCommissionProduct.getCommissionSource());
//计算商品提成金额
//判断提成类型
Double royaltyRateProduct = Double.valueOf(staffCommissionProduct.getRoyaltyRate().substring(0, staffCommissionProduct.getRoyaltyRate().length() - 1));
String unitProduct = staffCommissionProduct.getRoyaltyRate().substring(staffCommissionProduct.getRoyaltyRate().length() - 1);
//按照订单金额计算提成
double amountProduct = allOrderInfo.getGoodsMoney() - oilOrder.getOrderAmount();
double payAmountProduct = allOrderInfo.getPayMoney() - oilOrder.getPayAmount();
commissionRecordProduct.setDescription("订单支付金额:" + payAmountProduct);
if (staffCommissionProduct.getType().equals("orderAmount")) {
compute(amountProduct, staffCommissionProduct, unitProduct, commissionRecordProduct, royaltyRateProduct);
}
//按照实付金额计算提成
else if (staffCommissionProduct.getType().equals("payAmount")) {
compute(payAmountProduct, staffCommissionProduct, unitProduct, commissionRecordProduct, royaltyRateProduct);
}
commissionRecordMapper.insert(commissionRecordProduct);
}
return;
}
StaffCommission staffCommission = new StaffCommission(); StaffCommission staffCommission = new StaffCommission();
String type = "";
switch (allOrderInfo.getType()) {
case "1":
type = "0";
break;
case "2":
type = "1";
break;
case "3":
type = "3";
break;
case "5":
type = "3";
break;
}
for (StaffCommission staffCommission1 : staffCommissions) { for (StaffCommission staffCommission1 : staffCommissions) {
String[] split = staffCommission1.getStaffRoleGroup().split(","); String[] split = staffCommission1.getStaffRoleGroup().split(",");
String[] source = staffCommission1.getCommissionSource().split(","); if (Arrays.asList(split).contains(roleId)){
if (Arrays.asList(split).contains(roleId) && Arrays.asList(source).contains(commissionSource)){ if (staffCommission1.getClassify().equals(type)) {
staffCommission = staffCommission1; staffCommission = staffCommission1;
break; break;
}
} }
} }
if (ObjectUtil.isEmpty(staffCommission)) { if (ObjectUtil.isNotEmpty(staffCommission)) {
return 0; //添加提成记录表
CommissionRecord record = new CommissionRecord();
record.setStoreId(storeId);
record.setStaffId(staffId);
record.setOrderNo(allOrderInfo.getOrderNo());
record.setDescription("订单支付金额:" + allOrderInfo.getPayMoney());
record.setCreateTime(DateUtil.date());
record.setCreateBy(TokenUtil.getNowAccountInfo().getId().toString());
record.setCommissionSource(staffCommission.getCommissionSource());
//判断类型
switch(allOrderInfo.getType()){
case "1":
record.setType("1");
break;
case "2":
record.setType("2");
break;
case "3":
record.setType("3");
break;
case "5":
record.setType("6");
break;
}
//计算员工提成金额
//判断提成类型
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")) {
compute(allOrderInfo.getGoodsMoney(), staffCommission, unit, record, royaltyRate);
}
//按照实付金额计算提成
else if (staffCommission.getType().equals("payAmount")){
compute(allOrderInfo.getPayMoney(), staffCommission, unit, record, royaltyRate);
}
commissionRecordMapper.insert(record);
//如果是油品订单则更新油品订单的提成金额
if (allOrderInfo.getType().equals("1")) {
OilOrder oilOrder = oilOrderMapper.selectOne(new LambdaQueryWrapper<OilOrder>()
.eq(OilOrder::getOrderNo, allOrderInfo.getOrderNo()));
if (ObjectUtil.isNotEmpty(oilOrder)) {
oilOrder.setCommissionAmount(record.getAmount());
}
oilOrderMapper.updateById(oilOrder);
}
} }
//添加提成记录表
CommissionRecord record = new CommissionRecord();
record.setStoreId(storeId);
record.setStaffId(staffId);
record.setOrderNo(orderNo);
record.setDescription(commissionSource + "订单出售提成");
record.setCreateTime(DateUtil.date());
record.setCreateBy(TokenUtil.getNowAccountInfo().getId().toString());
record.setType(type);
//计算员工提成金额
//判断提成类型
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")) {
compute(amount, staffCommission, unit, record, royaltyRate);
}
//按照实付金额计算提成
else if (staffCommission.getType().equals("payAmount")){
compute(payAmount, staffCommission, unit, record, royaltyRate);
}
return commissionRecordMapper.insert(record);
} }
private void compute(Double allOrderInfo, StaffCommission staffCommission, String unit, CommissionRecord record, Double royaltyRate) { private void compute(Double allOrderInfo, StaffCommission staffCommission, String unit, CommissionRecord record, Double royaltyRate) {

View File

@ -1,6 +1,7 @@
package com.fuint.business.commission.service.impl; package com.fuint.business.commission.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -14,6 +15,8 @@ import com.fuint.business.commission.vo.StaffCommissionVo;
import com.fuint.business.member.entity.LJStaff; import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJDutyService; import com.fuint.business.member.service.ILJDutyService;
import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.mapper.AllOrderInfoMapper;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import com.fuint.system.role.entity.TDuty; import com.fuint.system.role.entity.TDuty;
@ -33,6 +36,8 @@ import java.util.*;
public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMapper, StaffCommission> implements StaffCommissionService { public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMapper, StaffCommission> implements StaffCommissionService {
@Autowired @Autowired
private ILJDutyService dutyService; private ILJDutyService dutyService;
@Autowired
private AllOrderInfoMapper allOrderInfoMapper;
@Override @Override
public IPage<StaffCommissionVo> selectCommissionList(Page page, StaffCommission commission) { public IPage<StaffCommissionVo> selectCommissionList(Page page, StaffCommission commission) {
@ -41,13 +46,13 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
commission.setStoreId(storeId); commission.setStoreId(storeId);
IPage<StaffCommissionVo> staffCommissionIPage = baseMapper.selectCommissionList(page, commission); IPage<StaffCommissionVo> staffCommissionIPage = baseMapper.selectCommissionList(page, commission);
for (StaffCommissionVo record : staffCommissionIPage.getRecords()) { for (StaffCommissionVo record : staffCommissionIPage.getRecords()) {
List<TDuty> tDuties = dutyService.selectDutyPage(new Page<>(1,10000),new TDuty()).getRecords(); List<TDuty> tDuties = dutyService.selectDutyPage(new Page<>(1, 10000), new TDuty()).getRecords();
String[] staffRoleGroup = record.getStaffRoleGroup().split(","); String[] staffRoleGroup = record.getStaffRoleGroup().split(",");
String str = ""; String str = "";
for (String staffRole : staffRoleGroup) { for (String staffRole : staffRoleGroup) {
for (TDuty tDuty : tDuties) { for (TDuty tDuty : tDuties) {
if (staffRole.equals(tDuty.getDutyId().toString())){ if (staffRole.equals(tDuty.getDutyId().toString())) {
str += tDuty.getDutyName()+","; str += tDuty.getDutyName() + ",";
} }
} }
} }
@ -67,10 +72,10 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId(); Integer storeId = nowAccountInfo.getStoreId();
QueryWrapper queryWrapper = new QueryWrapper<>(); QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id",storeId); queryWrapper.eq("store_id", storeId);
queryWrapper.eq("staff_role_group",commission.getStaffRoleGroup()); queryWrapper.eq("staff_role_group", commission.getStaffRoleGroup());
queryWrapper.eq("commission_source",commission.getCommissionSource()); queryWrapper.eq("commission_source", commission.getCommissionSource());
queryWrapper.eq("status","qy"); queryWrapper.eq("status", "qy");
StaffCommission commission1 = baseMapper.selectOne(queryWrapper); StaffCommission commission1 = baseMapper.selectOne(queryWrapper);
return commission1; return commission1;
} }
@ -85,7 +90,7 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
StaffCommission staffCommission = this.selectCommissionByRole(commission); StaffCommission staffCommission = this.selectCommissionByRole(commission);
int row = 0; int row = 0;
// 判断当前店铺是否存在同角色的同一提成方案 // 判断当前店铺是否存在同角色的同一提成方案
if (ObjectUtil.isNotEmpty(staffCommission)){ if (ObjectUtil.isNotEmpty(staffCommission)) {
row = 0; row = 0;
return row; return row;
} }
@ -101,7 +106,7 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
StaffCommission staffCommission = this.selectCommissionByRole(commission); StaffCommission staffCommission = this.selectCommissionByRole(commission);
int row = 0; int row = 0;
// 判断当前店铺是否存在同角色的同一提成方案 // 判断当前店铺是否存在同角色的同一提成方案
if (ObjectUtil.isNotEmpty(staffCommission) && staffCommission.getId()!=commission.getId()){ if (ObjectUtil.isNotEmpty(staffCommission) && staffCommission.getId() != commission.getId()) {
row = 0; row = 0;
return row; return row;
} }
@ -115,177 +120,180 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
private ILJStaffService staffService; private ILJStaffService staffService;
@Override @Override
public void countStaffCommission(Integer staffId,Integer storeId,Double amount,Double payAmount,String type,String orderNo) { public void countStaffCommission(Integer staffId, Integer storeId, Double amount, Double payAmount, String type, String orderNo) {
if (ObjectUtil.isNotEmpty(staffId)) { AllOrderInfo allOrderInfo = allOrderInfoMapper.selectOne(new LambdaQueryWrapper<AllOrderInfo>()
LJStaff staff = staffService.selectStaffById(staffId); .eq(AllOrderInfo::getOrderNo, orderNo));
QueryWrapper queryWrapper = new QueryWrapper<>(); commissionRecordService.addRecord(allOrderInfo.getId());
queryWrapper.eq("store_id", storeId); // if (ObjectUtil.isNotEmpty(staffId)) {
queryWrapper.eq("status", "qy"); // LJStaff staff = staffService.selectStaffById(staffId);
// 查询当前店铺启用的提成方案信息 // QueryWrapper queryWrapper = new QueryWrapper<>();
List<StaffCommission> list = baseMapper.selectList(queryWrapper); // queryWrapper.eq("store_id", storeId);
if (list.size() > 0 && ObjectUtil.isNotEmpty(staff)) { // queryWrapper.eq("status", "qy");
for (StaffCommission staffCommission : list) { //// 查询当前店铺启用的提成方案信息
CommissionRecord commissionRecord = new CommissionRecord(); // List<StaffCommission> list = baseMapper.selectList(queryWrapper);
String[] staffRoleGroups = staffCommission.getStaffRoleGroup().split(","); // if (list.size() > 0 && ObjectUtil.isNotEmpty(staff)) {
if (type.equals("1") && staffCommission.getCommissionSource().equals("车主加油")) { // for (StaffCommission staffCommission : list) {
for (String staffRoleGroup : staffRoleGroups) { // CommissionRecord commissionRecord = new CommissionRecord();
if (staff.getRoleId().equals(staffRoleGroup)) { // String[] staffRoleGroups = staffCommission.getStaffRoleGroup().split(",");
commissionRecord.setStaffId(staffId); // if (type.equals("1") && staffCommission.getCommissionSource().equals("车主加油")) {
commissionRecord.setStoreId(storeId); // for (String staffRoleGroup : staffRoleGroups) {
commissionRecord.setType(type); // if (staff.getRoleId().equals(staffRoleGroup)) {
commissionRecord.setDescription(staffCommission.getCommissionSource() + "订单出售提成"); // commissionRecord.setStaffId(staffId);
commissionRecord.setOrderNo(orderNo); // commissionRecord.setStoreId(storeId);
Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0, staffCommission.getRoyaltyRate().length() - 1)); // commissionRecord.setType(type);
String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length() - 1); // commissionRecord.setDescription(staffCommission.getCommissionSource() + "订单出售提成");
// 按照订单金额计算提成 // commissionRecord.setOrderNo(orderNo);
if (staffCommission.getType().equals("orderAmount")) { // Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0, staffCommission.getRoyaltyRate().length() - 1));
if (amount >= Double.valueOf(staffCommission.getMeetCondition())) { // String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length() - 1);
if (unit.equals("")) { //// 按照订单金额计算提成
commissionRecord.setAmount(royaltyRate); // if (staffCommission.getType().equals("orderAmount")) {
} // if (amount >= Double.valueOf(staffCommission.getMeetCondition())) {
if (unit.equals("%")) { // if (unit.equals("")) {
commissionRecord.setAmount(amount * (royaltyRate / 100)); // commissionRecord.setAmount(royaltyRate);
} // }
commissionRecordService.insertRecord(commissionRecord); // if (unit.equals("%")) {
} // commissionRecord.setAmount(amount * (royaltyRate / 100));
} // }
// 按照实付金额计算提成 // commissionRecordService.insertRecord(commissionRecord);
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 (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("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 (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 (type.equals("2") && staffCommission.getCommissionSource().equals("非油品")) {
if (type.equals("2") && staffCommission.getCommissionSource().equals("非油品")) { // for (String staffRoleGroup : staffRoleGroups) {
for (String staffRoleGroup : staffRoleGroups) { // if (staff.getRoleId().equals(staffRoleGroup)) {
if (staff.getRoleId().equals(staffRoleGroup)) { // commissionRecord.setStaffId(staffId);
commissionRecord.setStaffId(staffId); // commissionRecord.setStoreId(storeId);
commissionRecord.setStoreId(storeId); // commissionRecord.setType(type);
commissionRecord.setType(type); // commissionRecord.setDescription(staffCommission.getCommissionSource() + "订单出售提成");
commissionRecord.setDescription(staffCommission.getCommissionSource() + "订单出售提成"); // commissionRecord.setOrderNo(orderNo);
commissionRecord.setOrderNo(orderNo); // Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0, staffCommission.getRoyaltyRate().length() - 1));
Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0, staffCommission.getRoyaltyRate().length() - 1)); // String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length() - 1);
String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length() - 1); //// 按照订单金额计算提成
// 按照订单金额计算提成 // if (staffCommission.getType().equals("orderAmount")) {
if (staffCommission.getType().equals("orderAmount")) { // if (amount >= Double.valueOf(staffCommission.getMeetCondition())) {
if (amount >= Double.valueOf(staffCommission.getMeetCondition())) { // if (unit.equals("")) {
if (unit.equals("")) { // commissionRecord.setAmount(royaltyRate);
commissionRecord.setAmount(royaltyRate); // }
} // if (unit.equals("%")) {
if (unit.equals("%")) { // commissionRecord.setAmount(amount * (royaltyRate / 100));
commissionRecord.setAmount(amount * (royaltyRate / 100)); // }
} // }
} // }
} //// 按照实付金额计算提成
// 按照实付金额计算提成 // if (staffCommission.getType().equals("payAmount")) {
if (staffCommission.getType().equals("payAmount")) { // if (payAmount >= Double.valueOf(staffCommission.getMeetCondition())) {
if (payAmount >= Double.valueOf(staffCommission.getMeetCondition())) { // if (unit.equals("")) {
if (unit.equals("")) { // commissionRecord.setAmount(royaltyRate);
commissionRecord.setAmount(royaltyRate); // }
} // if (unit.equals("%")) {
if (unit.equals("%")) { // commissionRecord.setAmount(payAmount * (royaltyRate / 100));
commissionRecord.setAmount(payAmount * (royaltyRate / 100)); // }
} // }
} // }
} // commissionRecordService.insertRecord(commissionRecord);
commissionRecordService.insertRecord(commissionRecord); // }
} // }
} // }
} // if (type.equals("3") && staffCommission.getCommissionSource().equals("电子储值卡充值")) {
if (type.equals("3") && staffCommission.getCommissionSource().equals("电子储值卡充值")) { // for (String staffRoleGroup : staffRoleGroups) {
for (String staffRoleGroup : staffRoleGroups) { // if (staff.getRoleId().equals(staffRoleGroup)) {
if (staff.getRoleId().equals(staffRoleGroup)) { // commissionRecord.setStaffId(staffId);
commissionRecord.setStaffId(staffId); // commissionRecord.setStoreId(storeId);
commissionRecord.setStoreId(storeId); // commissionRecord.setType(type);
commissionRecord.setType(type); // commissionRecord.setDescription(staffCommission.getCommissionSource() + "订单出售提成");
commissionRecord.setDescription(staffCommission.getCommissionSource() + "订单出售提成"); // commissionRecord.setOrderNo(orderNo);
commissionRecord.setOrderNo(orderNo); // Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0, staffCommission.getRoyaltyRate().length() - 1));
Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0, staffCommission.getRoyaltyRate().length() - 1)); // String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length() - 1);
String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length() - 1); //// 按照订单金额计算提成
// 按照订单金额计算提成 // if (staffCommission.getType().equals("orderAmount")) {
if (staffCommission.getType().equals("orderAmount")) { // if (amount >= Double.valueOf(staffCommission.getMeetCondition())) {
if (amount >= Double.valueOf(staffCommission.getMeetCondition())) { // if (unit.equals("")) {
if (unit.equals("")) { // commissionRecord.setAmount(royaltyRate);
commissionRecord.setAmount(royaltyRate); // }
} // if (unit.equals("%")) {
if (unit.equals("%")) { // commissionRecord.setAmount(amount * (royaltyRate / 100));
commissionRecord.setAmount(amount * (royaltyRate / 100)); // }
} // }
} // }
} //// 按照实付金额计算提成
// 按照实付金额计算提成 // if (staffCommission.getType().equals("payAmount")) {
if (staffCommission.getType().equals("payAmount")) { // if (payAmount >= Double.valueOf(staffCommission.getMeetCondition())) {
if (payAmount >= Double.valueOf(staffCommission.getMeetCondition())) { // if (unit.equals("")) {
if (unit.equals("")) { // commissionRecord.setAmount(royaltyRate);
commissionRecord.setAmount(royaltyRate); // }
} // if (unit.equals("%")) {
if (unit.equals("%")) { // commissionRecord.setAmount(payAmount * (royaltyRate / 100));
commissionRecord.setAmount(payAmount * (royaltyRate / 100)); // }
} // }
} // }
} // commissionRecordService.insertRecord(commissionRecord);
commissionRecordService.insertRecord(commissionRecord); // }
} // }
} // }
} // if (type.equals("4") && staffCommission.getCommissionSource().equals("电子囤油卡充值")) {
if (type.equals("4") && staffCommission.getCommissionSource().equals("电子囤油卡充值")) { // for (String staffRoleGroup : staffRoleGroups) {
for (String staffRoleGroup : staffRoleGroups) { // if (staff.getRoleId().equals(staffRoleGroup)) {
if (staff.getRoleId().equals(staffRoleGroup)) { // commissionRecord.setStaffId(staffId);
commissionRecord.setStaffId(staffId); // commissionRecord.setStoreId(storeId);
commissionRecord.setStoreId(storeId); // commissionRecord.setType(type);
commissionRecord.setType(type); // commissionRecord.setDescription(staffCommission.getCommissionSource() + "订单出售提成");
commissionRecord.setDescription(staffCommission.getCommissionSource() + "订单出售提成"); // commissionRecord.setOrderNo(orderNo);
commissionRecord.setOrderNo(orderNo); // Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0, staffCommission.getRoyaltyRate().length() - 1));
Double royaltyRate = Double.valueOf(staffCommission.getRoyaltyRate().substring(0, staffCommission.getRoyaltyRate().length() - 1)); // String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length() - 1);
String unit = staffCommission.getRoyaltyRate().substring(staffCommission.getRoyaltyRate().length() - 1); //// 按照订单金额计算提成
// 按照订单金额计算提成 // if (staffCommission.getType().equals("orderAmount")) {
if (staffCommission.getType().equals("orderAmount")) { // if (amount >= Double.valueOf(staffCommission.getMeetCondition())) {
if (amount >= Double.valueOf(staffCommission.getMeetCondition())) { // if (unit.equals("")) {
if (unit.equals("")) { // commissionRecord.setAmount(royaltyRate);
commissionRecord.setAmount(royaltyRate); // }
} // if (unit.equals("%")) {
if (unit.equals("%")) { // commissionRecord.setAmount(amount * (royaltyRate / 100));
commissionRecord.setAmount(amount * (royaltyRate / 100)); // }
} // }
} // }
} //// 按照实付金额计算提成
// 按照实付金额计算提成 // if (staffCommission.getType().equals("payAmount")) {
if (staffCommission.getType().equals("payAmount")) { // if (payAmount >= Double.valueOf(staffCommission.getMeetCondition())) {
if (payAmount >= Double.valueOf(staffCommission.getMeetCondition())) { // if (unit.equals("")) {
if (unit.equals("")) { // commissionRecord.setAmount(royaltyRate);
commissionRecord.setAmount(royaltyRate); // }
} // if (unit.equals("%")) {
if (unit.equals("%")) { // commissionRecord.setAmount(payAmount * (royaltyRate / 100));
commissionRecord.setAmount(payAmount * (royaltyRate / 100)); // }
} // }
} // }
} // commissionRecordService.insertRecord(commissionRecord);
commissionRecordService.insertRecord(commissionRecord); // }
} // }
} // }
} // }
} // }
} // }
}
} }
} }

View File

@ -64,6 +64,10 @@ public class AllOrderInfo extends BaseEntity implements Serializable {
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date payTime; private Date payTime;
/**
* 店员id
*/
private Integer staffId;
/** /**
* 付款方式数据字典 * 付款方式数据字典
*/ */