From fa01fb7c6db32c03b8b70228ea683eafbcfdd020 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 16 六月 2026 13:58:33 +0800
Subject: [PATCH] 工资社保计算错误

---
 src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java b/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
index be8abe5..60607ba 100644
--- a/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
+++ b/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
@@ -172,8 +172,8 @@
                 : calculateLatestDeptSocialSupplementAmount(staffOnJobDto);
         BigDecimal pieceSalary = normalizeMoney(getBigDecimal(map, "pieceSalary"));
         BigDecimal hourlySalary = normalizeMoney(getBigDecimal(map, "hourlySalary"));
-        BigDecimal socialPersonal = normalizeMoney(getBigDecimal(map, "socialPersonal"));
-        BigDecimal fundPersonal = normalizeMoney(getBigDecimal(map, "fundPersonal"));
+        BigDecimal socialPersonal = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+        BigDecimal fundPersonal = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
 
         UserProductionAccountingDto userProductionAccountingDto = new UserProductionAccountingDto();
         userProductionAccountingDto.setUserId(getUidByStaffId(staffId));
@@ -194,9 +194,9 @@
                 }
                 for (SchemeInsuranceDetail detail : detailList) {
                     if("鍏Н閲�".equals(detail.getInsuranceType())){
-                        fundPersonal = fundPersonal.add(calculateByEmployeeIdType(detail.getInsuranceType(), fundPersonal, staffOnJobDto, detail));
+                        fundPersonal = calculateByEmployeeIdType(detail.getInsuranceType(), fundPersonal, basicSalary, staffOnJobDto, detail);
                     }else{
-                        socialPersonal = socialPersonal.add(calculateByEmployeeIdType(detail.getInsuranceType(), socialPersonal, staffOnJobDto, detail));
+                        socialPersonal = calculateByEmployeeIdType(detail.getInsuranceType(), socialPersonal, basicSalary, staffOnJobDto, detail);
                     }
                 }
             }
@@ -263,14 +263,14 @@
      * @param detail
      * @return
      */
-    public BigDecimal calculateByEmployeeIdType(String type,BigDecimal bigDecimal, StaffOnJob staffOnJobDto,SchemeInsuranceDetail detail) {
+    public BigDecimal calculateByEmployeeIdType(String type,BigDecimal bigDecimal, BigDecimal basicSalary, StaffOnJob staffOnJobDto,SchemeInsuranceDetail detail) {
         // 鍒ゆ柇鏄惁璋冪敤鍩烘湰宸ヨ祫
         if (detail.getUseBasicSalary() == 1) {
             BigDecimal divide = detail.getPaymentBase().multiply(detail.getPersonalRatio()).divide(new BigDecimal("100"), 2);
             bigDecimal = bigDecimal.add(divide);
         }else{
-            // 璋冪敤鍩烘湰宸ヨ祫
-            BigDecimal multiply = staffOnJobDto.getBasicSalary().multiply(detail.getPersonalRatio().divide(new BigDecimal("100"), 2));
+            // 璋冪敤褰撳墠宸ヨ祫琛ㄤ腑鐨勫熀鏈伐璧�
+            BigDecimal multiply = basicSalary.multiply(detail.getPersonalRatio().divide(new BigDecimal("100"), 2));
             bigDecimal = bigDecimal.add(multiply);
         }
         bigDecimal = bigDecimal.add(detail.getPersonalFixed());
@@ -292,8 +292,12 @@
         BigDecimal socialSupplementAmount = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
         for (SchemeInsuranceDetail detail : detailList) {
             if (!"鍏Н閲�".equals(detail.getInsuranceType())) {
-                socialSupplementAmount = socialSupplementAmount.add(
-                        calculateByEmployeeIdType(detail.getInsuranceType(), socialSupplementAmount, staffOnJobDto, detail)
+                socialSupplementAmount = calculateByEmployeeIdType(
+                        detail.getInsuranceType(),
+                        socialSupplementAmount,
+                        normalizeMoney(staffOnJobDto.getBasicSalary()),
+                        staffOnJobDto,
+                        detail
                 );
             }
         }

--
Gitblit v1.9.3