From ba100c651a81162a9a9a4533ff4d072f2889171a Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期五, 06 十一月 2026 09:38:46 +0800
Subject: [PATCH] fix(hrm): 考勤统计支持员工姓名搜索;缺卡统计补全(与考勤记录联动)

---
 yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSalaryCalculationServiceImpl.java |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 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 647f3a1..aa54240 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
@@ -281,7 +281,7 @@
                 .add(fullAttendanceBonus)
                 .add(mealAllowance).add(transportAllowance).add(otherAllowance).add(overtimePay);
 
-        // 鑾峰彇绀句繚鍩烘暟锛氬憳宸ョぞ淇濇。妗� > 鍛樺伐鍩烘湰宸ヨ祫
+        // 绀句繚鍩烘暟锛氬彧鍙栧憳宸ョぞ淇濇。妗堥噷閰嶇疆鐨勭即绾冲熀鏁帮紱鏈厤缃椂鐢ㄥ熀鏈伐璧�
         BigDecimal socialSecurityBase = (socialSecurity != null && socialSecurity.getSocialSecurityBase() != null)
                 ? socialSecurity.getSocialSecurityBase() : baseSalary;
 
@@ -292,17 +292,31 @@
                 ? scheme.getMedicalPersonalRatio() : DEFAULT_MEDICAL_PERSONAL_RATIO;
         BigDecimal unemploymentPersonalRatio = (scheme != null && scheme.getUnemploymentPersonalRatio() != null)
                 ? scheme.getUnemploymentPersonalRatio() : DEFAULT_UNEMPLOYMENT_PERSONAL_RATIO;
+        // 澶х梾鍖荤枟 / 闀挎湡鎶ょ悊鐨勪釜浜烘瘮渚嬶細鏂规閲屽彲鑳戒负绌猴紝涓虹┖瑙嗕负 0锛堜笉鎵o級
+        BigDecimal seriousIllnessPersonalRatio = (scheme != null && scheme.getSeriousIllnessPersonalRatio() != null)
+                ? scheme.getSeriousIllnessPersonalRatio() : BigDecimal.ZERO;
+        BigDecimal longTermCarePersonalRatio = (scheme != null && scheme.getLongTermCarePersonalRatio() != null)
+                ? scheme.getLongTermCarePersonalRatio() : BigDecimal.ZERO;
 
         // 鍏Н閲戜釜浜烘瘮渚嬶細鍙彇鏂规閰嶇疆鍊硷紝涓嶅啀鍥為��榛樿姣斾緥銆�
         // 鍚﹀垯銆屽叕鍙告病閰嶅叕绉噾鏂规銆嶆椂浼氳鎸夐粯璁� 12% 鎵f锛堣繖灏辨槸瀹㈡埛鍙嶉鐨勯棶棰橈級銆�
         BigDecimal housingFundPersonalRatio = scheme != null ? scheme.getHousingFundPersonalRatio() : null;
 
-        // 绀句繚鎵i櫎 = 鍩烘暟 脳 (鍏昏�佷釜浜烘瘮渚� + 鍖荤枟涓汉姣斾緥 + 澶变笟涓汉姣斾緥)
-        BigDecimal socialSecurityDeduction = socialSecurityBase
-                .multiply(pensionPersonalRatio)
-                .add(socialSecurityBase.multiply(medicalPersonalRatio))
-                .add(socialSecurityBase.multiply(unemploymentPersonalRatio))
-                .setScale(2, RoundingMode.HALF_UP);
+        // 绀句繚鎵i櫎锛氬繀椤汇�屽憳宸ラ厤缃簡绀句繚妗f銆嶆墠鎵f銆�
+        // 涔嬪墠鏃犺鏈夋病鏈夌ぞ淇濇。妗堥兘鎸� 鍩烘暟 脳 榛樿姣斾緥(0.08+0.02+0.005=10.5%) 鎵f锛�
+        // 瀵艰嚧 102 涓病鍔犵ぞ淇濈殑鍛樺伐琚墸浜� 204.75锛�= 鍩烘湰宸ヨ祫 1950 脳 10.5%锛夈��
+        // 涓汉搴旂即 = 鍏昏�� + 鍖荤枟 + 澶变笟 + 澶х梾鍖荤枟 + 闀挎湡鎶ょ悊銆�
+        // 娉ㄦ剰锛氬師鏉ユ紡绠椾簡鍚庝袱椤癸紝浣垮緱銆屽叺鍥簲闄┿�嶄笌銆屽湴鏂逛簲闄┿�嶄袱涓柟妗堢畻鍑烘潵鐨勬墸娆惧畬鍏ㄤ竴鏍枫��
+        BigDecimal socialSecurityDeduction = BigDecimal.ZERO;
+        if (socialSecurity != null) {
+            BigDecimal personalTotalRatio = pensionPersonalRatio
+                    .add(medicalPersonalRatio)
+                    .add(unemploymentPersonalRatio)
+                    .add(seriousIllnessPersonalRatio)
+                    .add(longTermCarePersonalRatio);
+            socialSecurityDeduction = socialSecurityBase.multiply(personalTotalRatio)
+                    .setScale(2, RoundingMode.HALF_UP);
+        }
 
         // 鍏Н閲戞墸闄わ細蹇呴』鍚屾椂婊¤冻銆屾柟妗堥厤缃簡鍏Н閲戞瘮渚� > 0銆嶄笖銆屽憳宸ユ。妗堥厤缃簡鍏Н閲戝熀鏁� > 0銆嶆墠鎵f锛�
         // 浠讳竴涓嶆弧瓒抽兘瑙嗕负鍏徃鏈即绾冲叕绉噾锛屾墸娆句负 0銆�

--
Gitblit v1.9.3