diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/entity/CommissionRecord.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/entity/CommissionRecord.java index 1d717803d..0933b1781 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/entity/CommissionRecord.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/entity/CommissionRecord.java @@ -64,6 +64,10 @@ public class CommissionRecord extends BaseEntity { */ @TableField(exist = false) private String roleId; + /** + * 提成卡来源:油品非油品 + */ + private String commissionSource; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/CommissionRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/CommissionRecordService.java index 79ab9ebbb..9f4c80b69 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/CommissionRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/CommissionRecordService.java @@ -109,5 +109,5 @@ public interface CommissionRecordService { * @param orderNo 订单号 * @return */ - int addRecord(Integer storeId, String type,Integer staffId,Double amount,Double payAmount, String classify, String commissionSource,String orderNo); + void addRecord(Integer orderId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/CommissionRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/CommissionRecordServiceImpl.java index 09fc15e3c..99d2c8f71 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/CommissionRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/CommissionRecordServiceImpl.java @@ -16,7 +16,9 @@ import com.fuint.business.commission.vo.StaffPercentageVo; import com.fuint.business.member.entity.LJStaff; import com.fuint.business.member.service.ILJStaffService; 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.OilOrderMapper; import com.fuint.repository.mapper.NewMtStaffMapper; import com.fuint.repository.model.NewMtStaff; import org.springframework.beans.factory.annotation.Autowired; @@ -47,6 +49,8 @@ public class CommissionRecordServiceImpl implements CommissionRecordService { private NewMtStaffMapper newMtStaffMapper; @Autowired private StaffCommissionMapper staffCommissionMapper; + @Autowired + private OilOrderMapper oilOrderMapper; /** * 通过ID查询单条数据 @@ -220,7 +224,7 @@ public class CommissionRecordServiceImpl implements CommissionRecordService { /** * 添加提成记录信息 * @param storeId 店铺id - * @param type 类型:1.油品订单出售;2.商品订单出售;3.储值卡充值;4.油品退款;5.商品退款;6.囤油卡充值 + * @param commission_source 类型:1.油品订单出售;2.商品订单出售;3.储值卡充值;4.油品退款;5.商品退款;6.囤油卡充值 * @param staffId 员工id * @param amount 订单金额 * @param payAmount 实际支付金额 @@ -230,7 +234,11 @@ public class CommissionRecordServiceImpl implements CommissionRecordService { * @return */ @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查询用户角色 NewMtStaff newMtStaff = newMtStaffMapper.selectById(staffId); if (ObjectUtil.isNull(newMtStaff)) { @@ -240,42 +248,158 @@ public class CommissionRecordServiceImpl implements CommissionRecordService { //查询对应的提成策略 List staffCommissions = staffCommissionMapper.selectList(new LambdaQueryWrapper() .eq(StaffCommission::getStoreId, storeId) - .eq(StaffCommission::getClassify, classify) .eq(StaffCommission::getStatus, "qy")); + //判断是否是油品与商品混合订单 + if (allOrderInfo.getType().equals("6")){ + //查询油品订单信息 + OilOrder oilOrder = oilOrderMapper.selectOne(new LambdaQueryWrapper() + .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(); + 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) { String[] split = staffCommission1.getStaffRoleGroup().split(","); - String[] source = staffCommission1.getCommissionSource().split(","); - if (Arrays.asList(split).contains(roleId) && Arrays.asList(source).contains(commissionSource)){ - staffCommission = staffCommission1; - break; + if (Arrays.asList(split).contains(roleId)){ + if (staffCommission1.getClassify().equals(type)) { + staffCommission = staffCommission1; + break; + } } } - if (ObjectUtil.isEmpty(staffCommission)) { - return 0; + if (ObjectUtil.isNotEmpty(staffCommission)) { + //添加提成记录表 + 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() + .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) { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/StaffCommissionServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/StaffCommissionServiceImpl.java index 910914fc3..ec2af7de5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/StaffCommissionServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/StaffCommissionServiceImpl.java @@ -1,6 +1,7 @@ package com.fuint.business.commission.service.impl; 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.metadata.IPage; 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.service.ILJDutyService; 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.util.TokenUtil; import com.fuint.system.role.entity.TDuty; @@ -33,6 +36,8 @@ import java.util.*; public class StaffCommissionServiceImpl extends ServiceImpl implements StaffCommissionService { @Autowired private ILJDutyService dutyService; + @Autowired + private AllOrderInfoMapper allOrderInfoMapper; @Override public IPage selectCommissionList(Page page, StaffCommission commission) { @@ -41,13 +46,13 @@ public class StaffCommissionServiceImpl extends ServiceImpl staffCommissionIPage = baseMapper.selectCommissionList(page, commission); for (StaffCommissionVo record : staffCommissionIPage.getRecords()) { - List tDuties = dutyService.selectDutyPage(new Page<>(1,10000),new TDuty()).getRecords(); + List tDuties = dutyService.selectDutyPage(new Page<>(1, 10000), new TDuty()).getRecords(); String[] staffRoleGroup = record.getStaffRoleGroup().split(","); String str = ""; for (String staffRole : staffRoleGroup) { for (TDuty tDuty : tDuties) { - if (staffRole.equals(tDuty.getDutyId().toString())){ - str += tDuty.getDutyName()+","; + if (staffRole.equals(tDuty.getDutyId().toString())) { + str += tDuty.getDutyName() + ","; } } } @@ -67,10 +72,10 @@ public class StaffCommissionServiceImpl extends ServiceImpl(); - queryWrapper.eq("store_id",storeId); - queryWrapper.eq("staff_role_group",commission.getStaffRoleGroup()); - queryWrapper.eq("commission_source",commission.getCommissionSource()); - queryWrapper.eq("status","qy"); + queryWrapper.eq("store_id", storeId); + queryWrapper.eq("staff_role_group", commission.getStaffRoleGroup()); + queryWrapper.eq("commission_source", commission.getCommissionSource()); + queryWrapper.eq("status", "qy"); StaffCommission commission1 = baseMapper.selectOne(queryWrapper); return commission1; } @@ -85,7 +90,7 @@ public class StaffCommissionServiceImpl extends ServiceImpl(); - queryWrapper.eq("store_id", storeId); - queryWrapper.eq("status", "qy"); -// 查询当前店铺启用的提成方案信息 - List list = baseMapper.selectList(queryWrapper); - if (list.size() > 0 && ObjectUtil.isNotEmpty(staff)) { - for (StaffCommission staffCommission : list) { - CommissionRecord commissionRecord = new CommissionRecord(); - String[] staffRoleGroups = staffCommission.getStaffRoleGroup().split(","); - if (type.equals("1") && 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)); - } - 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); + public void countStaffCommission(Integer staffId, Integer storeId, Double amount, Double payAmount, String type, String orderNo) { + AllOrderInfo allOrderInfo = allOrderInfoMapper.selectOne(new LambdaQueryWrapper() + .eq(AllOrderInfo::getOrderNo, orderNo)); + commissionRecordService.addRecord(allOrderInfo.getId()); +// if (ObjectUtil.isNotEmpty(staffId)) { +// LJStaff staff = staffService.selectStaffById(staffId); +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("store_id", storeId); +// queryWrapper.eq("status", "qy"); +//// 查询当前店铺启用的提成方案信息 +// List list = baseMapper.selectList(queryWrapper); +// if (list.size() > 0 && ObjectUtil.isNotEmpty(staff)) { +// for (StaffCommission staffCommission : list) { +// CommissionRecord commissionRecord = new CommissionRecord(); +// String[] staffRoleGroups = staffCommission.getStaffRoleGroup().split(","); +// if (type.equals("1") && 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)); +// } +// commissionRecordService.insertRecord(commissionRecord); // } -// 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("非油品")) { - 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("3") && 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("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("2") && 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("3") && 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("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); +// } +// } +// } +// } +// } +// } } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfo.java index 12a529f27..526b616e0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfo.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/AllOrderInfo.java @@ -64,6 +64,10 @@ public class AllOrderInfo extends BaseEntity implements Serializable { */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") private Date payTime; + /** + * 店员id + */ + private Integer staffId; /** * 付款方式(数据字典) */