Commit b9d580538696b67905e469c9ee1508a70a3e5360
Merge branch 'jc-salary_calc_method_2024-3-30' into 'main'
Jc salary calc method 2024 3 30 See merge request !618
Showing
3 changed files
with
72 additions
and
1 deletions
fw-morax-domain/src/main/java/cn/fw/morax/domain/enums/SalaryCalMethodEnum.java
... | ... | @@ -13,12 +13,13 @@ import lombok.Getter; |
13 | 13 | */ |
14 | 14 | public enum SalaryCalMethodEnum implements IEnum<Integer> { |
15 | 15 | /** |
16 | - * 计算方式;1: 星级 2:固定金额 3:阶梯提成 4:车系提成 99:动态 | |
16 | + * 计算方式;1: 星级 2:固定金额 3:阶梯提成 4:车系提成 5:自定义 99:动态 | |
17 | 17 | */ |
18 | 18 | STAR(1, "员工星级"), |
19 | 19 | FIXATION(2, "固定金额"), |
20 | 20 | LADDER(3, "台阶提成"), |
21 | 21 | CAR_SERIES(4, "车系提成"), |
22 | + CUSTOM(5, "自定义提成"), | |
22 | 23 | DYNAMIC(99, "动态计算"), |
23 | 24 | ; |
24 | 25 | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/task/SalaryReportTask.java
... | ... | @@ -1105,6 +1105,11 @@ public class SalaryReportTask { |
1105 | 1105 | projectBO.setCodeType(Optional.ofNullable(project.getLadderCodeType()).orElse(IndicatorCodeTypeEnum.INDICATOR)); |
1106 | 1106 | break; |
1107 | 1107 | } |
1108 | + case CUSTOM: { | |
1109 | + projectBO.setCode(project.getCommissionCode()); | |
1110 | + projectBO.setCodeType(Optional.ofNullable(project.getLadderCodeType()).orElse(IndicatorCodeTypeEnum.INDICATOR)); | |
1111 | + break; | |
1112 | + } | |
1108 | 1113 | } |
1109 | 1114 | //基本工资不能下钻 |
1110 | 1115 | if (getBaseSalaryCode().equals(projectBO.getCode())) { | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/calculator/salary/CustomSalaryCalculator.java
0 → 100644
1 | +package cn.fw.morax.service.biz.calculator.salary; | |
2 | + | |
3 | +import cn.fw.morax.domain.db.salary.SalaryGroupProject; | |
4 | +import cn.fw.morax.domain.db.salary.SalaryGroupProjectParam; | |
5 | +import cn.fw.morax.domain.db.salary.SalaryGroupProjectPrecondition; | |
6 | +import cn.fw.morax.domain.db.salary.SalaryGroupUser; | |
7 | +import cn.fw.morax.domain.enums.ParamTypeEnum; | |
8 | +import cn.fw.morax.domain.enums.SalaryCalMethodEnum; | |
9 | +import cn.fw.morax.service.biz.kpi.KpiPoolCommonService; | |
10 | +import lombok.extern.slf4j.Slf4j; | |
11 | +import org.springframework.beans.factory.annotation.Autowired; | |
12 | +import org.springframework.stereotype.Component; | |
13 | +import org.springframework.util.CollectionUtils; | |
14 | + | |
15 | +import java.math.BigDecimal; | |
16 | +import java.util.List; | |
17 | + | |
18 | +/** | |
19 | + * @author : kurisu | |
20 | + * @version : 1.0 | |
21 | + * @className : StarSalaryCalculator | |
22 | + * @description : 星级薪资计算器 | |
23 | + * @date : 2022-04-27 10:33 | |
24 | + */ | |
25 | +@Component | |
26 | +@Slf4j | |
27 | +public class CustomSalaryCalculator extends SalaryBaseCalculator { | |
28 | + | |
29 | + private final KpiPoolCommonService kpiPoolCommonService; | |
30 | + | |
31 | + @Autowired | |
32 | + public CustomSalaryCalculator(final KpiPoolCommonService kpiPoolCommonService) { | |
33 | + this.kpiPoolCommonService = kpiPoolCommonService; | |
34 | + } | |
35 | + | |
36 | + @Override | |
37 | + public SalaryCalMethodEnum getCalMethod() { | |
38 | + return SalaryCalMethodEnum.CUSTOM; | |
39 | + } | |
40 | + | |
41 | + @Override | |
42 | + public BigDecimal calculate(SalaryGroupProject salaryGroupProject, SalaryGroupUser user) { | |
43 | + if (Boolean.TRUE.equals(user.getProbationer())) { | |
44 | + return null; | |
45 | + } | |
46 | + final Long salaryGroupProjectId = salaryGroupProject.getId(); | |
47 | + List<SalaryGroupProjectPrecondition> preconditionList = queryPrecondition(salaryGroupProjectId); | |
48 | + boolean examined = examinePrecondition(preconditionList, user); | |
49 | + if (!examined) { | |
50 | + return BigDecimal.ZERO; | |
51 | + } | |
52 | + List<SalaryGroupProjectParam> projectParamList = queryProjectParam(salaryGroupProjectId, ParamTypeEnum.COMMISSION); | |
53 | + if (CollectionUtils.isEmpty(projectParamList)) { | |
54 | + return BigDecimal.ZERO; | |
55 | + } | |
56 | + final BigDecimal commissionValue = calculateParamValue(projectParamList, user); | |
57 | + clearProjectHitLog(salaryGroupProjectId, user); | |
58 | + saveProjectHitLog(salaryGroupProjectId, user, log -> { | |
59 | + log.setSalaryValue(commissionValue); | |
60 | + log.setHitLadderValue(null); | |
61 | + log.setHitCommissionValue(commissionValue); | |
62 | + }); | |
63 | + return commissionValue; | |
64 | + } | |
65 | +} | ... | ... |