Commit abdef890 by 张富康

feat(perfSalary): 新增绩效规则按月份查询及自动评绩效字段支持

- 在AutoPerformRuleDetailDTO中添加isAutoPerform字段及注释说明
- 修改AutoPerformRuleMapper.xml,将delete语句改为update,更新最新规则删除标记
- 新增PerformanceMonthlyMapper接口及对应XML,实现按年月查询绩效规则
- PerfRuleRemoteImpl实现perfRuleConfigGet接口,支持异常捕获及日志记录
- PerfRuleRemoteService新增perfRuleConfigGet方法,结合PerformanceMonthly数据组装规则详情
- 通过配置的默认等级编码进行规则处理
- 关联查询性能等级并设置对应星级数
1 parent 5de8ff46
...@@ -22,6 +22,12 @@ public class AutoPerformRuleDetailDTO implements Serializable { ...@@ -22,6 +22,12 @@ public class AutoPerformRuleDetailDTO implements Serializable {
private Integer id; private Integer id;
/** /**
* 是否自动评绩效(1=是,0=否)
*/
@ApiModelProperty(notes = "是否自动评绩效(1=是,0=否)")
private Integer isAutoPerform;
/**
* 当月入职新员工-出勤天数条件(1-30)≥次天数 * 当月入职新员工-出勤天数条件(1-30)≥次天数
*/ */
@ApiModelProperty(notes = "当月入职新员工-出勤天数条件(1-30)≥次天数") @ApiModelProperty(notes = "当月入职新员工-出勤天数条件(1-30)≥次天数")
......
...@@ -17,4 +17,5 @@ public interface AutoPerformRuleMapper extends OreMapper<AutoPerformRule> { ...@@ -17,4 +17,5 @@ public interface AutoPerformRuleMapper extends OreMapper<AutoPerformRule> {
List<PerformanceLevelDetailDTO> getPerformanceLevels(@Param("uuid") String uuid); List<PerformanceLevelDetailDTO> getPerformanceLevels(@Param("uuid") String uuid);
void deleteLatestRuleConfig(); void deleteLatestRuleConfig();
} }
\ No newline at end of file \ No newline at end of file
...@@ -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.PerformanceMonthly; import cn.com.glsx.dj.staff.model.perfSalary.PerformanceMonthly;
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;
@Mapper @Mapper
public interface PerformanceMonthlyMapper extends OreMapper<PerformanceMonthly> { public interface PerformanceMonthlyMapper extends OreMapper<PerformanceMonthly> {
/**
* 通过年月找到对应月份采用的绩效规则
*/
PerformanceMonthly findByYearMonth(@Param("monthDate") String monthDate);
} }
\ No newline at end of file \ No newline at end of file
...@@ -49,7 +49,12 @@ public class PerfRuleRemoteImpl implements PerfRuleRemote { ...@@ -49,7 +49,12 @@ public class PerfRuleRemoteImpl implements PerfRuleRemote {
*/ */
@Override @Override
public RpcResponse<PerfRuleConfigDetailDTO> perfRuleConfigGet(PerfRuleReqDTO perfRuleReqDTO) { public RpcResponse<PerfRuleConfigDetailDTO> perfRuleConfigGet(PerfRuleReqDTO perfRuleReqDTO) {
return null; try {
return RpcResponse.success(perfRuleRemoteService.perfRuleConfigGet(perfRuleReqDTO));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
} }
/** /**
......
...@@ -5,12 +5,15 @@ import cn.com.glsx.dj.staff.enums.perfSalary.EffectiveStatusEnum; ...@@ -5,12 +5,15 @@ import cn.com.glsx.dj.staff.enums.perfSalary.EffectiveStatusEnum;
import cn.com.glsx.dj.staff.enums.perfSalary.PerfRuleConfigStarEnum; import cn.com.glsx.dj.staff.enums.perfSalary.PerfRuleConfigStarEnum;
import cn.com.glsx.dj.staff.mapper.perfSalary.AutoPerformRuleMapper; import cn.com.glsx.dj.staff.mapper.perfSalary.AutoPerformRuleMapper;
import cn.com.glsx.dj.staff.mapper.perfSalary.PerformanceLevelMapper; import cn.com.glsx.dj.staff.mapper.perfSalary.PerformanceLevelMapper;
import cn.com.glsx.dj.staff.mapper.perfSalary.PerformanceMonthlyMapper;
import cn.com.glsx.dj.staff.model.perfSalary.AutoPerformRule; import cn.com.glsx.dj.staff.model.perfSalary.AutoPerformRule;
import cn.com.glsx.dj.staff.model.perfSalary.PerformanceLevel; import cn.com.glsx.dj.staff.model.perfSalary.PerformanceLevel;
import cn.com.glsx.dj.staff.model.perfSalary.PerformanceMonthly;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.oreframework.boot.env.OrePropertyConfigurer; import org.oreframework.boot.env.OrePropertyConfigurer;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -35,6 +38,9 @@ public class PerfRuleRemoteService { ...@@ -35,6 +38,9 @@ public class PerfRuleRemoteService {
@Resource @Resource
private PerformanceLevelMapper performanceLevelMapper; private PerformanceLevelMapper performanceLevelMapper;
@Resource
private PerformanceMonthlyMapper performanceMonthlyMapper;
// 当月入职新员工-规则外的默认等级编码 // 当月入职新员工-规则外的默认等级编码
String monthOnboardDefaultLevelCode = OrePropertyConfigurer.getProperty("month_onboard_default_level_code", String.class, "B"); String monthOnboardDefaultLevelCode = OrePropertyConfigurer.getProperty("month_onboard_default_level_code", String.class, "B");
// 非月入职员工-规则外的默认等级编码 // 非月入职员工-规则外的默认等级编码
...@@ -116,7 +122,29 @@ public class PerfRuleRemoteService { ...@@ -116,7 +122,29 @@ public class PerfRuleRemoteService {
return true; return true;
} }
/**
* 获取对应月份采用的绩效规则
*/
public PerfRuleConfigDetailDTO perfRuleConfigGet(PerfRuleReqDTO perfRuleReqDTO) {
PerfRuleConfigDetailDTO result = new PerfRuleConfigDetailDTO();
Date queryMonth = perfRuleReqDTO.getQueryMonth();
// 通过月份查询 sal_performance_monthly
PerformanceMonthly salPerformanceMonthly = performanceMonthlyMapper.findByYearMonth(DateUtil.formatDate(queryMonth));
if (ObjectUtil.isEmpty(salPerformanceMonthly)) {
return result;
}
if (ObjectUtil.equals(salPerformanceMonthly.getIsAutoPerform(), 1)) {
AutoPerformRule autoPerformRule = autoPerformRuleMapper.selectByPrimaryKey(salPerformanceMonthly.getAutoPerformRuleId());
AutoPerformRuleDetailDTO autoPerformRuleDetailDTO = BeanUtil.copyProperties(autoPerformRule, AutoPerformRuleDetailDTO.class);
result.setAutoPerformRuleDetailDTO(autoPerformRuleDetailDTO);
}
List<PerformanceLevelDetailDTO> performanceLevels = autoPerformRuleMapper.getPerformanceLevels(salPerformanceMonthly.getPerformanceLevelUuid());
for (PerformanceLevelDetailDTO item : performanceLevels) {
item.setStarCount(PerfRuleConfigStarEnum.getStartCountByLevel(item.getLevelCode()));
}
result.setPerformanceLevelDetailDTOS(performanceLevels);
return result;
}
/** /**
* 判断指定日期时间字符串是否属于未来月份 * 判断指定日期时间字符串是否属于未来月份
...@@ -145,4 +173,5 @@ public class PerfRuleRemoteService { ...@@ -145,4 +173,5 @@ public class PerfRuleRemoteService {
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -43,12 +43,13 @@ ...@@ -43,12 +43,13 @@
WHERE uuid = #{uuid} <!-- 通过外部参数传入 --> WHERE uuid = #{uuid} <!-- 通过外部参数传入 -->
</select> </select>
<delete id="deleteLatestRuleConfig"> <update id="deleteLatestRuleConfig">
UPDATE sal_auto_perform_rule UPDATE sal_auto_perform_rule
SET deleted_flag = 'D' SET deleted_flag = 'D'
WHERE effective_month > Date(now()) WHERE effective_month > Date(now())
ORDER BY created_date DESC ORDER BY created_date DESC
LIMIT 1 LIMIT 1
</delete> </update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -4,4 +4,12 @@ ...@@ -4,4 +4,12 @@
<mapper namespace="cn.com.glsx.dj.staff.mapper.perfSalary.PerformanceMonthlyMapper"> <mapper namespace="cn.com.glsx.dj.staff.mapper.perfSalary.PerformanceMonthlyMapper">
<select id="findByYearMonth" resultType="cn.com.glsx.dj.staff.model.perfSalary.PerformanceMonthly">
SELECT month_date AS monthDate,
is_auto_perform AS isAutoPerform,
auto_perform_rule_id AS autoPerformRuleId,
performance_level_uuid AS performanceLevelUuid
FROM sal_performance_monthly
WHERE Date(month_date) = #{monthDate}
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!