From d85ec778237cd9af68c8d6b96895d22e0cf158df Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期一, 02 十一月 2026 14:15:17 +0800
Subject: [PATCH] fix(hrm/system): 修复调岗申请与提交报错、公积金误扣、用户搜索,新增核算批量删除

---
 yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSalaryCalculationServiceImpl.java |   44 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSalaryCalculationServiceImpl.java b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSalaryCalculationServiceImpl.java
index 5ed819e..8c61cad 100644
--- a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSalaryCalculationServiceImpl.java
+++ b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSalaryCalculationServiceImpl.java
@@ -277,19 +277,17 @@
         BigDecimal socialSecurityBase = (socialSecurity != null && socialSecurity.getSocialSecurityBase() != null)
                 ? socialSecurity.getSocialSecurityBase() : baseSalary;
 
-        // 鑾峰彇鍏Н閲戝熀鏁帮細鍛樺伐绀句繚妗f > 鍛樺伐鍩烘湰宸ヨ祫
-        BigDecimal housingFundBase = (socialSecurity != null && socialSecurity.getHousingFundBase() != null)
-                ? socialSecurity.getHousingFundBase() : baseSalary;
-
-        // 浠庢柟妗堜腑鑾峰彇缂寸撼姣斾緥锛堜紭鍏堜娇鐢ㄦ柟妗堜腑鐨勬瘮渚嬶紝鍚﹀垯浣跨敤榛樿姣斾緥锛�
+        // 浠庢柟妗堜腑鑾峰彇绀句繚缂寸撼姣斾緥锛堟柟妗堟湭閰嶇疆鏃跺洖閫�榛樿姣斾緥锛�
         BigDecimal pensionPersonalRatio = (scheme != null && scheme.getPensionPersonalRatio() != null)
                 ? scheme.getPensionPersonalRatio() : DEFAULT_PENSION_PERSONAL_RATIO;
         BigDecimal medicalPersonalRatio = (scheme != null && scheme.getMedicalPersonalRatio() != null)
                 ? scheme.getMedicalPersonalRatio() : DEFAULT_MEDICAL_PERSONAL_RATIO;
         BigDecimal unemploymentPersonalRatio = (scheme != null && scheme.getUnemploymentPersonalRatio() != null)
                 ? scheme.getUnemploymentPersonalRatio() : DEFAULT_UNEMPLOYMENT_PERSONAL_RATIO;
-        BigDecimal housingFundPersonalRatio = (scheme != null && scheme.getHousingFundPersonalRatio() != null)
-                ? scheme.getHousingFundPersonalRatio() : DEFAULT_HOUSING_FUND_PERSONAL_RATIO;
+
+        // 鍏Н閲戜釜浜烘瘮渚嬶細鍙彇鏂规閰嶇疆鍊硷紝涓嶅啀鍥為��榛樿姣斾緥銆�
+        // 鍚﹀垯銆屽叕鍙告病閰嶅叕绉噾鏂规銆嶆椂浼氳鎸夐粯璁� 12% 鎵f锛堣繖灏辨槸瀹㈡埛鍙嶉鐨勯棶棰橈級銆�
+        BigDecimal housingFundPersonalRatio = scheme != null ? scheme.getHousingFundPersonalRatio() : null;
 
         // 绀句繚鎵i櫎 = 鍩烘暟 脳 (鍏昏�佷釜浜烘瘮渚� + 鍖荤枟涓汉姣斾緥 + 澶变笟涓汉姣斾緥)
         BigDecimal socialSecurityDeduction = socialSecurityBase
@@ -298,8 +296,15 @@
                 .add(socialSecurityBase.multiply(unemploymentPersonalRatio))
                 .setScale(2, RoundingMode.HALF_UP);
 
-        // 鍏Н閲戞墸闄� = 鍩烘暟 脳 鍏Н閲戜釜浜烘瘮渚�
-        BigDecimal housingFundDeduction = housingFundBase.multiply(housingFundPersonalRatio).setScale(2, RoundingMode.HALF_UP);
+        // 鍏Н閲戞墸闄わ細蹇呴』鍚屾椂婊¤冻銆屾柟妗堥厤缃簡鍏Н閲戞瘮渚� > 0銆嶄笖銆屽憳宸ユ。妗堥厤缃簡鍏Н閲戝熀鏁� > 0銆嶆墠鎵f锛�
+        // 浠讳竴涓嶆弧瓒抽兘瑙嗕负鍏徃鏈即绾冲叕绉噾锛屾墸娆句负 0銆�
+        BigDecimal housingFundDeduction = BigDecimal.ZERO;
+        BigDecimal housingFundBase = socialSecurity != null ? socialSecurity.getHousingFundBase() : null;
+        if (housingFundPersonalRatio != null && housingFundPersonalRatio.signum() > 0
+                && housingFundBase != null && housingFundBase.signum() > 0) {
+            housingFundDeduction = housingFundBase.multiply(housingFundPersonalRatio)
+                    .setScale(2, RoundingMode.HALF_UP);
+        }
 
         // 璁$畻璇峰亣鎵f
         BigDecimal leaveDeduction = calculateLeaveDeduction(employee, period, baseSalary);
@@ -873,4 +878,25 @@
         salaryCalculationMapper.deleteById(id);
     }
 
+    /**
+     * 鎵归噺鍒犻櫎鏍哥畻璁板綍锛堝叏閫夊悗涓�閿垹闄わ級
+     *
+     * 璇存槑锛氭寜涓氬姟瑕佹眰锛屾壒閲忓垹闄や笉闄愬埗鐘舵�侊紝鍕鹃�夊嵆鍒犮��
+     * 涓嶅瓨鍦ㄧ殑 ID 鐩存帴璺宠繃锛屼笉鎶ラ敊锛堥伩鍏嶅墠绔嬀閫夊垪琛ㄤ笌搴撲笉涓�鑷存椂鏁翠綋澶辫触锛夈��
+     */
+    @Override
+    public Integer deleteSalaryCalculationList(List<Long> ids) {
+        if (CollUtil.isEmpty(ids)) {
+            return 0;
+        }
+        List<Long> existIds = salaryCalculationMapper.selectBatchIds(ids).stream()
+                .map(HrmSalaryCalculationDO::getId)
+                .collect(Collectors.toList());
+        if (CollUtil.isEmpty(existIds)) {
+            return 0;
+        }
+        salaryCalculationMapper.deleteByIds(existIds);
+        return existIds.size();
+    }
+
 }

--
Gitblit v1.9.3