Commit 2e4c58cc by 张富康

feat(perfSalary): 优化自动绩效计算及考勤数据处理逻辑

- 自动绩效计算支持试用期和转正期间薪资按天数比例计算
- 新增判断试用期和转正存在性方法,精确评估考勤月份状态
- 基于出勤天数和产值阈值设置不同绩效等级及奖励系数
- 实现单条绩效数据插入独立事务,保证失败回滚并记录错误日志
- 考勤打卡处理逻辑新增离职日期判断,过滤离职后打卡数据
- PerformanceEvaluation模型调整日期字段类型为字符串,并新增离职日期字段
- 扩展数据库操作,支持性能评估记录的插入或更新(单条及批量)
- 代码格式及日志记录优化,提升代码可读性和稳定性
1 parent 361fdac8
...@@ -41,6 +41,8 @@ public class AutoPerformRule implements Serializable { ...@@ -41,6 +41,8 @@ public class AutoPerformRule implements Serializable {
@Column(name = "month_onboard_output_threshold") @Column(name = "month_onboard_output_threshold")
private Integer monthOnboardOutputThreshold; private Integer monthOnboardOutputThreshold;
/** /**
* 当月入职新员工-触发规则后的等级编码 * 当月入职新员工-触发规则后的等级编码
*/ */
...@@ -63,6 +65,7 @@ public class AutoPerformRule implements Serializable { ...@@ -63,6 +65,7 @@ public class AutoPerformRule implements Serializable {
private BigDecimal monthOnboardTriggerRewardCoefficient; private BigDecimal monthOnboardTriggerRewardCoefficient;
/** /**
* 当月入职新员工-规则外的默认等级编码 * 当月入职新员工-规则外的默认等级编码
*/ */
...@@ -84,6 +87,8 @@ public class AutoPerformRule implements Serializable { ...@@ -84,6 +87,8 @@ public class AutoPerformRule implements Serializable {
@Column(name = "month_onboard_default_reward_coefficient") @Column(name = "month_onboard_default_reward_coefficient")
private BigDecimal monthOnboardDefaultRewardCoefficient; private BigDecimal monthOnboardDefaultRewardCoefficient;
/** /**
* 非月入职员工-产值阈值(5000-20000)<此值 * 非月入职员工-产值阈值(5000-20000)<此值
*/ */
...@@ -91,6 +96,8 @@ public class AutoPerformRule implements Serializable { ...@@ -91,6 +96,8 @@ public class AutoPerformRule implements Serializable {
@Column(name = "no_month_onboard_output_threshold") @Column(name = "no_month_onboard_output_threshold")
private Integer noMonthOnboardOutputThreshold; private Integer noMonthOnboardOutputThreshold;
/** /**
* 非月入职员工-触发规则后的等级编码 * 非月入职员工-触发规则后的等级编码
*/ */
...@@ -98,7 +105,6 @@ public class AutoPerformRule implements Serializable { ...@@ -98,7 +105,6 @@ public class AutoPerformRule implements Serializable {
@Column(name = "no_month_onboard_trigger_level_code") @Column(name = "no_month_onboard_trigger_level_code")
private String noMonthOnboardTriggerLevelCode; private String noMonthOnboardTriggerLevelCode;
/** /**
* 非月入职员工-触发规则后的等级编码-分数范围 * 非月入职员工-触发规则后的等级编码-分数范围
*/ */
...@@ -113,6 +119,8 @@ public class AutoPerformRule implements Serializable { ...@@ -113,6 +119,8 @@ public class AutoPerformRule implements Serializable {
@Column(name = "no_month_onboard_trigger_reward_coefficient") @Column(name = "no_month_onboard_trigger_reward_coefficient")
private BigDecimal noMonthOnboardTriggerRewardCoefficient; private BigDecimal noMonthOnboardTriggerRewardCoefficient;
/** /**
* 非月入职员工-规则外的默认等级编码 * 非月入职员工-规则外的默认等级编码
*/ */
...@@ -134,6 +142,8 @@ public class AutoPerformRule implements Serializable { ...@@ -134,6 +142,8 @@ public class AutoPerformRule implements Serializable {
@Column(name = "no_month_onboard_default_reward_coefficient") @Column(name = "no_month_onboard_default_reward_coefficient")
private BigDecimal noMonthOnboardDefaultRewardCoefficient; private BigDecimal noMonthOnboardDefaultRewardCoefficient;
/** /**
* 生效月份(yyyy-mm格式) * 生效月份(yyyy-mm格式)
*/ */
......
...@@ -45,9 +45,8 @@ public class PerformanceEvaluation implements Serializable { ...@@ -45,9 +45,8 @@ public class PerformanceEvaluation implements Serializable {
* 评分月份(yyyy-mm) * 评分月份(yyyy-mm)
*/ */
@ApiModelProperty(notes = "评分月份(yyyy-mm)") @ApiModelProperty(notes = "评分月份(yyyy-mm)")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "evaluation_month") @Column(name = "evaluation_month")
private Date evaluationMonth; private String evaluationMonth;
/** /**
* 绩效等级-系统自动设置 * 绩效等级-系统自动设置
...@@ -57,18 +56,19 @@ public class PerformanceEvaluation implements Serializable { ...@@ -57,18 +56,19 @@ public class PerformanceEvaluation implements Serializable {
private String autoGradeCode; private String autoGradeCode;
/** /**
* 分数范围-系统自动设置
*/
@ApiModelProperty(notes = "分数范围-系统自动设置")
@Column(name = "auto_score_symbol_value")
private String autoScoreSymbolValue;
/**
* 奖励系数-系统自动设置 * 奖励系数-系统自动设置
*/ */
@ApiModelProperty(notes = "奖励系数-系统自动设置") @ApiModelProperty(notes = "奖励系数-系统自动设置")
@Column(name = "auto_reward_coefficient") @Column(name = "auto_reward_coefficient")
private BigDecimal autoRewardCoefficient; private BigDecimal autoRewardCoefficient;
/**
* 分数范围-系统自动设置
*/
@ApiModelProperty(notes = "分数范围-系统自动设置")
@Column(name = "auto_score_symbol_value")
private String autoScoreSymbolValue;
/** /**
* 绩效等级-手动设置 * 绩效等级-手动设置
...@@ -106,50 +106,67 @@ public class PerformanceEvaluation implements Serializable { ...@@ -106,50 +106,67 @@ public class PerformanceEvaluation implements Serializable {
private Integer isAutoPerformance; private Integer isAutoPerformance;
/**
* 绩效工资
*/
@ApiModelProperty(notes = "绩效工资")
@Column(name = "performance_salary")
private BigDecimal performanceSalary;
/** /**
* 转正前底薪 * 转正前工资
*/ */
@ApiModelProperty(notes = "转正前底薪") @ApiModelProperty(notes = "转正前工资")
@Column(name = "before_correction_basic_salary") @Column(name = "before_correction_basic_salary")
private BigDecimal beforeCorrectionBasicSalary; private BigDecimal beforeCorrectionBasicSalary;
/** /**
* 转正后底薪 * 转正后工资
*/ */
@ApiModelProperty(notes = "转正后底薪") @ApiModelProperty(notes = "转正后工资")
@Column(name = "after_correction_basic_salary") @Column(name = "after_correction_basic_salary")
private BigDecimal afterCorrectionBasicSalary; private BigDecimal afterCorrectionBasicSalary;
/** /**
* 考勤计算后-试用期阶段底薪 (已乘70%) * 底薪占工资占比 默认0.7
*/ */
@ApiModelProperty(notes = "考勤计算后-试用期阶段底薪") @ApiModelProperty(notes = "底薪占工资占比 默认0.7")
@Column(name = "basic_salary_ratio")
private BigDecimal basicSalaryRatio;
/**
* 考勤计算后-试用期阶段工资
*/
@ApiModelProperty(notes = "考勤计算后-试用期阶段工资")
@Column(name = "after_attendance_probation_basic_salary") @Column(name = "after_attendance_probation_basic_salary")
private BigDecimal afterAttendanceProbationBasicSalary; private BigDecimal afterAttendanceProbationBasicSalary;
/** /**
* 考勤计算后-转正后阶段底薪 (已乘70%) * 考勤计算后-转正后阶段工资
*/ */
@ApiModelProperty(notes = "考勤计算后-转正后阶段底薪") @ApiModelProperty(notes = "考勤计算后-转正后阶段工资")
@Column(name = "after_attendance_regular_basic_salary") @Column(name = "after_attendance_regular_basic_salary")
private BigDecimal afterAttendanceRegularBasicSalary; private BigDecimal afterAttendanceRegularBasicSalary;
/** /**
* 考勤计算后-合计底薪 (已乘70%) * 考勤计算后-合计工资
*/ */
@ApiModelProperty(notes = "考勤计算后-合计底薪") @ApiModelProperty(notes = "考勤计算后-合计工资")
@Column(name = "after_attendance_total_basic_salary") @Column(name = "after_attendance_total_basic_salary")
private BigDecimal afterAttendanceTotalBasicSalary; private BigDecimal afterAttendanceTotalBasicSalary;
/** /**
* 基本工资(底薪+绩效工资) * 底薪 = 考勤计算后-合计工资 x basic_salary_ratio
*/
@ApiModelProperty(notes = "底薪")
@Column(name = "base_salary")
private BigDecimal baseSalary;
/**
* 绩效工资 = 考勤计算后-合计工资 x (1 - basic_salary_ratio) x 评分系数
*/
@ApiModelProperty(notes = "绩效工资")
@Column(name = "performance_salary")
private BigDecimal performanceSalary;
/**
* 基本工资 = (底薪 + 绩效工资)
*/ */
@ApiModelProperty(notes = "基本工资(底薪+绩效工资)") @ApiModelProperty(notes = "基本工资(底薪+绩效工资)")
@Column(name = "basic_salary") @Column(name = "basic_salary")
...@@ -173,17 +190,22 @@ public class PerformanceEvaluation implements Serializable { ...@@ -173,17 +190,22 @@ public class PerformanceEvaluation implements Serializable {
* 入职日期 * 入职日期
*/ */
@ApiModelProperty(notes = "入职日期") @ApiModelProperty(notes = "入职日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "entry_date") @Column(name = "entry_date")
private Date entryDate; private String entryDate;
/** /**
* 转正日期 * 转正日期
*/ */
@ApiModelProperty(notes = "转正日期") @ApiModelProperty(notes = "转正日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "correction_date") @Column(name = "correction_date")
private Date correctionDate; private String correctionDate;
/**
* 离职日期
*/
@ApiModelProperty(notes = "离职日期")
@Column(name = "leave_date")
private String leaveDate;
/** /**
* 是否该月入职:1-是,0-否 * 是否该月入职:1-是,0-否
...@@ -193,9 +215,9 @@ public class PerformanceEvaluation implements Serializable { ...@@ -193,9 +215,9 @@ public class PerformanceEvaluation implements Serializable {
private Integer isEntry; private Integer isEntry;
/** /**
* 是否试用期:1-是,0-否 * 该月是否试用期:1-是,0-否
*/ */
@ApiModelProperty(notes = "是否试用期:1-是,0-否") @ApiModelProperty(notes = "该月是否试用期:1-是,0-否")
@Column(name = "is_probation") @Column(name = "is_probation")
private Integer isProbation; private Integer isProbation;
...@@ -206,19 +228,13 @@ public class PerformanceEvaluation implements Serializable { ...@@ -206,19 +228,13 @@ public class PerformanceEvaluation implements Serializable {
@Column(name = "is_correction") @Column(name = "is_correction")
private Integer isCorrection; private Integer isCorrection;
/**
* 该月是否离职 1-是,0-否
*/
@ApiModelProperty(notes = "该月是否离职 1-是,0-否")
@Column(name = "is_leaving")
private Integer isLeaving;
/** /**
* 门店名称 * 门店名称
*/ */
@ApiModelProperty(notes = "门店名称") @ApiModelProperty(notes = "门店名称")
@Column(name = "merchant_name") @Column(name = "merchant_name")
private Integer merchantName; private String merchantName;
/** /**
......
...@@ -2,9 +2,15 @@ package cn.com.glsx.dj.staff.mapper.perfSalary; ...@@ -2,9 +2,15 @@ package cn.com.glsx.dj.staff.mapper.perfSalary;
import cn.com.glsx.dj.staff.model.perfSalary.PerformanceEvaluation; import cn.com.glsx.dj.staff.model.perfSalary.PerformanceEvaluation;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper @Mapper
public interface PerformanceEvaluationMapper extends OreMapper<PerformanceEvaluation> { public interface PerformanceEvaluationMapper extends OreMapper<PerformanceEvaluation> {
void insertOrUpdate(PerformanceEvaluation performanceEvaluation);
void insertOrUpdateBatch(@Param("list") List<PerformanceEvaluation> performanceEvaluationList);
} }
\ No newline at end of file \ No newline at end of file
...@@ -283,6 +283,13 @@ public class AttendanceDataCleansingService { ...@@ -283,6 +283,13 @@ public class AttendanceDataCleansingService {
for (StaffQwClockClean clockInfo : staffQwClockCleans) { for (StaffQwClockClean clockInfo : staffQwClockCleans) {
try { try {
// 2. 处理每条考勤记录 // 2. 处理每条考勤记录
// 判断该打卡日期是否在离职直接之后,如果在离职日期之后则不计算
if (StrUtil.isNotBlank(employee.getLastWorkDate())) {
if(DateUtil.compare(DateUtil.parse(clockInfo.getClockInDate(), "yyyy-MM-dd"), DateUtil.parse(employee.getLastWorkDate(), "yyyy-MM-dd")) > 0){
log.info("{} 打卡日期:{},离职日期:{} 打卡日期在离职日期之后,不处理", employee.getStaffName(), clockInfo.getClockInDate(), employee.getLastWorkDate());
continue;
}
}
ClockInResult result = processClockIn(clockInfo, lastMonthYMD, employee); ClockInResult result = processClockIn(clockInfo, lastMonthYMD, employee);
workHours = NumberUtil.add(workHours, result.getTotalWorkHours()); workHours = NumberUtil.add(workHours, result.getTotalWorkHours());
lateEarlyMinutes = NumberUtil.add(lateEarlyMinutes, result.getLateEarlyMinutes()); lateEarlyMinutes = NumberUtil.add(lateEarlyMinutes, result.getLateEarlyMinutes());
...@@ -739,7 +746,8 @@ public class AttendanceDataCleansingService { ...@@ -739,7 +746,8 @@ public class AttendanceDataCleansingService {
String clockInDate = clockInfo.getClockInDate(); String clockInDate = clockInfo.getClockInDate();
String officialDate = employee.getOfficialDate(); String officialDate = employee.getOfficialDate();
// yyyy-MM-dd 比较clockInDate officialDate 日期大小 该打卡日期是否转正后 // yyyy-MM-dd 比较clockInDate officialDate 日期大小 该打卡日期是否转正后
boolean isAfterOfficialDate = StrUtil.isNotBlank(officialDate) && DateUtil.compare(DateUtil.parse(clockInDate, "yyyy-MM-dd"), DateUtil.parse(officialDate, "yyyy-MM-dd")) >= 0; boolean isAfterOfficialDate = StrUtil.isNotBlank(officialDate)
&& DateUtil.compare(DateUtil.parse(clockInDate, "yyyy-MM-dd"), DateUtil.parse(officialDate, "yyyy-MM-dd")) >= 0;
BigDecimal totalWorkHours = BigDecimal.ZERO; BigDecimal totalWorkHours = BigDecimal.ZERO;
BigDecimal lateEarlyMinutes = BigDecimal.ZERO; BigDecimal lateEarlyMinutes = BigDecimal.ZERO;
// todz // todz
...@@ -785,6 +793,7 @@ public class AttendanceDataCleansingService { ...@@ -785,6 +793,7 @@ public class AttendanceDataCleansingService {
} }
} }
// 4. 处理下班打卡 // 4. 处理下班打卡
if (ObjectUtil.isNotEmpty(clockInfo.getClockOutTimeEnd())) { if (ObjectUtil.isNotEmpty(clockInfo.getClockOutTimeEnd())) {
// 判断经纬度是否在商户打卡地址100米范围内 // 判断经纬度是否在商户打卡地址100米范围内
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!