From d476e7d1595e131f2bb7bb1a62c00fa3e82fb0a7 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期一, 19 十月 2026 17:23:30 +0800
Subject: [PATCH] feat: 添加员工工资明细中的请假、缺勤、迟到、早退次数及手动扣工资字段
---
src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java | 39 +++++++++++++++++++++++++++++----------
1 files changed, 29 insertions(+), 10 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..fe84134 100644
--- a/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
+++ b/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.project.system.mapper.SysDeptMapper;
import com.ruoyi.project.system.mapper.SysUserMapper;
import com.ruoyi.staff.controller.TaxCalculator;
+import com.ruoyi.staff.dto.SalaryStat;
import com.ruoyi.staff.mapper.SchemeApplicableStaffMapper;
import com.ruoyi.staff.mapper.SchemeInsuranceDetailMapper;
import com.ruoyi.staff.mapper.StaffOnJobMapper;
@@ -50,6 +51,7 @@
private final SysDeptMapper sysDeptMapper;
private final StaffOnJobMapper staffOnJobMapper;
private final SalesLedgerProductionAccountingService salesLedgerProductionAccountingService;
+ private final SalaryStatServiceImpl salaryStatService;
@Override
@@ -172,8 +174,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 +196,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);
}
}
}
@@ -213,7 +215,12 @@
.add(socialPersonal)
.add(socialSupplementAmount)
.add(otherDeduct);
- BigDecimal netSalary = grossSalary.subtract(deductSalary);
+ // 搴旀墸宸ヨ祫锛堟墜鍔ㄥ~鍐欙級锛屼粠瀹炲彂宸ヨ祫涓墸闄�
+ BigDecimal manualDeduct = normalizeMoney(getBigDecimal(map, "manualDeduct"));
+ BigDecimal netSalary = grossSalary.subtract(deductSalary).subtract(manualDeduct);
+
+ // 璇峰亣娆℃暟銆佺己鍕ゆ鏁般�佽繜鍒版鏁般�佹棭閫�娆℃暟锛岃鍋囧師鍥犺嚜鍔ㄥ甫鍏ュ娉紙澶囨敞宸插~鍐欐椂淇濈暀鍘熷娉級
+ SalaryStat salaryStat = salaryStatService.stat(staffId, staffOnJobDto.getStaffName(), date);
if (!hasText(map, "staffName")) {
map.put("staffName", staffOnJobDto.getStaffName());
@@ -232,7 +239,15 @@
map.put("grossSalary", grossSalary);
map.put("salaryTax", salaryTax);
map.put("deductSalary", deductSalary);
+ map.put("leaveCount", salaryStat.getLeaveCount());
+ map.put("absenceCount", salaryStat.getAbsenceCount());
+ map.put("lateCount", salaryStat.getLateCount());
+ map.put("earlyCount", salaryStat.getEarlyCount());
+ map.put("manualDeduct", manualDeduct);
map.put("netSalary", netSalary);
+ if (!hasText(map, "remark") && StringUtils.isNotEmpty(salaryStat.getLeaveReason())) {
+ map.put("remark", salaryStat.getLeaveReason());
+ }
}
/**
@@ -263,14 +278,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 +307,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