From 1d372d5e4916eaecf9b773e52e0d887d4fd0e47a Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期四, 05 十一月 2026 15:02:27 +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