Commit d0574ee5 by 张富康

fix(performance): 优化月份条件比较方式及时间格式处理

- 将AttendanceSummaryMapper和PerformanceMonthlyMapper中按月份查询的SQL去除日期格式化,改为直接比较日期字段
- 修改PerfRuleRemoteService中生效月份和查询月份相关逻辑,统一采用字符串格式处理月份
- 修正判断生效月份是否为当月或未来月份的逻辑,避免日期转换异常
- 保持查询效率及代码简洁,提升性能和稳定性
1 parent 768acf66
......@@ -83,8 +83,8 @@ public class PerfRuleRemoteService {
AutoPerformRuleUpdateDTO autoPerformRuleUpdateDTO = perfRuleConfigUpdateDTO.getAutoPerformRuleUpdateDTO();
List<PerformanceLevelUpdateDTO> performanceLevelUpdateDTOS = perfRuleConfigUpdateDTO.getPerformanceLevelUpdateDTOS();
// hutool判断生效月份是当月或未来月份 如果不是则抛异常
Date effectiveMonth = autoPerformRuleUpdateDTO.getEffectiveMonth();
if (!isCurrentAndFutureMonth(DateUtil.formatDate(effectiveMonth))) {
String effectiveMonth = autoPerformRuleUpdateDTO.getEffectiveMonth() + "-01";
if (!isCurrentAndFutureMonth(effectiveMonth)) {
throw new RpcServiceException("生效时间应大于等于当前月");
}
// 删除最新的配置
......@@ -136,9 +136,9 @@ public class PerfRuleRemoteService {
*/
public PerfRuleConfigDetailDTO perfRuleConfigGet(PerfRuleReqDTO perfRuleReqDTO) {
PerfRuleConfigDetailDTO result = new PerfRuleConfigDetailDTO();
Date queryMonth = perfRuleReqDTO.getQueryMonth();
String queryMonth = perfRuleReqDTO.getQueryMonth();
// 通过月份查询 sal_performance_monthly
PerformanceMonthly salPerformanceMonthly = performanceMonthlyMapper.findByYearMonth(DateUtil.formatDate(queryMonth));
PerformanceMonthly salPerformanceMonthly = performanceMonthlyMapper.findByYearMonth(queryMonth);
if (ObjectUtil.isEmpty(salPerformanceMonthly)) {
return result;
}
......
......@@ -99,7 +99,7 @@
WHERE
superior_leader_mobile_phone = #{regionManagerMobilePhone}
<if test="attendanceMonth != null and attendanceMonth != ''">
AND DATE_FORMAT(attendance_month, '%Y-%m') = #{attendanceMonth}
AND attendance_month = #{attendanceMonth}
</if>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%')
......@@ -122,6 +122,6 @@
and sbbi.deleted_flag = 'N'
where sas.deleted_flag = 'N'
and sas.mobile_phone = #{mobilePhone}
and DATE_FORMAT(sas.attendance_month, '%Y-%m') = #{attendanceMonth}
and sas.attendance_month = #{attendanceMonth}
</select>
</mapper>
\ No newline at end of file
......@@ -10,7 +10,7 @@
auto_perform_rule_id AS autoPerformRuleId,
performance_level_uuid AS performanceLevelUuid
FROM sal_performance_monthly
WHERE Date(month_date) = #{monthDate}
WHERE month_date = #{monthDate}
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!