feat(oa): 新增工资明细批量插入接口支持字符串格式数字- 新增 BatchInsertSalaryStringDto 和 SalaryDetailStringDto 类用于处理字符串格式的工资数据
- 在 OaSalaryMasterController 中添加新的批量插入接口 - 实现 SalaryStringConverter 工具类用于字符串数据转换 - 优化了前端数据传输格式,支持驼峰命名的字符串数字
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package com.ruoyi.oa.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量插入工资明细请求DTO - 处理驼峰命名的字符串数字格式
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
@Data
|
||||
public class BatchInsertSalaryStringDto {
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
@NotBlank(message = "单位名称不能为空")
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 工资所属期间,格式如:2025-8
|
||||
*/
|
||||
@NotBlank(message = "工资期间不能为空")
|
||||
private String salaryPeriod;
|
||||
|
||||
/**
|
||||
* 总经理审批状态或姓名
|
||||
*/
|
||||
private String gmApproval;
|
||||
|
||||
/**
|
||||
* 财务审核状态或姓名
|
||||
*/
|
||||
private String financeAudit;
|
||||
|
||||
/**
|
||||
* 出纳姓名
|
||||
*/
|
||||
private String cashier;
|
||||
|
||||
/**
|
||||
* 部门主管姓名
|
||||
*/
|
||||
private String deptManager;
|
||||
|
||||
/**
|
||||
* 经办人姓名
|
||||
*/
|
||||
private String operator;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 工资明细列表
|
||||
*/
|
||||
@Valid
|
||||
@NotEmpty(message = "明细列表不能为空")
|
||||
private List<SalaryDetailStringDto> salaryDetailList;
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
package com.ruoyi.oa.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 工资明细字符串DTO - 用于接收前端字符串格式的数字字段
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
@Data
|
||||
public class SalaryDetailStringDto {
|
||||
|
||||
/**
|
||||
* 主键,自增
|
||||
*/
|
||||
private Long detailId;
|
||||
|
||||
/**
|
||||
* 关联主表ID
|
||||
*/
|
||||
private Long mainId;
|
||||
|
||||
/**
|
||||
* 序号(字符串格式)
|
||||
*/
|
||||
private String serialNumber;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private String dept;
|
||||
|
||||
/**
|
||||
* 员工姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 基本工资(字符串格式)
|
||||
*/
|
||||
private String basicSalary;
|
||||
|
||||
/**
|
||||
* 岗位工资(字符串格式)
|
||||
*/
|
||||
private String postSalary;
|
||||
|
||||
/**
|
||||
* 餐补(字符串格式)
|
||||
*/
|
||||
private String mealAllowance;
|
||||
|
||||
/**
|
||||
* 住房补贴(字符串格式)
|
||||
*/
|
||||
private String housingAllowance;
|
||||
|
||||
/**
|
||||
* 公交补贴(字符串格式)
|
||||
*/
|
||||
private String busAllowance;
|
||||
|
||||
/**
|
||||
* 出差天数(字符串格式)
|
||||
*/
|
||||
private String businessDaysOther;
|
||||
|
||||
/**
|
||||
* 出差补助(字符串格式)
|
||||
*/
|
||||
private String businessAllowance;
|
||||
|
||||
/**
|
||||
* 社保补助(字符串格式)
|
||||
*/
|
||||
private String socialSecurityAllowance;
|
||||
|
||||
/**
|
||||
* 加班时长(字符串格式)
|
||||
*/
|
||||
private String overtimeHours;
|
||||
|
||||
/**
|
||||
* 加班标准(字符串格式)
|
||||
*/
|
||||
private String overtimeRate;
|
||||
|
||||
/**
|
||||
* 加班工资总计(字符串格式)
|
||||
*/
|
||||
private String overtimeTotal;
|
||||
|
||||
/**
|
||||
* 出勤天数(字符串格式)
|
||||
*/
|
||||
private String businessDays;
|
||||
|
||||
/**
|
||||
* 请假扣款(字符串格式)
|
||||
*/
|
||||
private String leaveDeduction;
|
||||
|
||||
/**
|
||||
* 其他扣款(字符串格式)
|
||||
*/
|
||||
private String otherDeduction;
|
||||
|
||||
/**
|
||||
* 应发工资(字符串格式)
|
||||
*/
|
||||
private String grossSalary;
|
||||
|
||||
/**
|
||||
* 个人缴纳养老保险(字符串格式)
|
||||
*/
|
||||
private String personalPension;
|
||||
|
||||
/**
|
||||
* 个人缴纳医疗保险(字符串格式)
|
||||
*/
|
||||
private String personalMedical;
|
||||
|
||||
/**
|
||||
* 个人缴纳失业保险(字符串格式)
|
||||
*/
|
||||
private String personalUnemployment;
|
||||
|
||||
/**
|
||||
* 个人缴纳大病医疗(字符串格式)
|
||||
*/
|
||||
private String personalBigMedical;
|
||||
|
||||
/**
|
||||
* 个人缴纳住房公积金(字符串格式)
|
||||
*/
|
||||
private String personalHousingFund;
|
||||
|
||||
/**
|
||||
* 个人所得税(字符串格式)
|
||||
*/
|
||||
private String personalTax;
|
||||
|
||||
/**
|
||||
* 实发工资(字符串格式)
|
||||
*/
|
||||
private String netSalary;
|
||||
|
||||
/**
|
||||
* 企业缴纳养老保险(字符串格式)
|
||||
*/
|
||||
private String enterprisePension;
|
||||
|
||||
/**
|
||||
* 企业缴纳医疗保险(字符串格式)
|
||||
*/
|
||||
private String enterpriseMedical;
|
||||
|
||||
/**
|
||||
* 企业缴纳工伤保险(字符串格式)
|
||||
*/
|
||||
private String enterpriseInjury;
|
||||
|
||||
/**
|
||||
* 企业缴纳失业保险(字符串格式)
|
||||
*/
|
||||
private String enterpriseUnemployment;
|
||||
|
||||
/**
|
||||
* 企业缴纳生育保险(字符串格式)
|
||||
*/
|
||||
private String enterpriseMaternity;
|
||||
|
||||
/**
|
||||
* 企业缴纳住房公积金(字符串格式)
|
||||
*/
|
||||
private String enterpriseHousingFund;
|
||||
|
||||
/**
|
||||
* 企业缴纳大病医疗(字符串格式)
|
||||
*/
|
||||
private String enterpriseBigMedical;
|
||||
|
||||
/**
|
||||
* 单位总支出(字符串格式)
|
||||
*/
|
||||
private String unitTotalExpense;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
// 辅助方法:安全地将字符串转换为BigDecimal
|
||||
@JsonIgnore
|
||||
private BigDecimal parseDecimal(String value) {
|
||||
if (value == null || value.trim().isEmpty()) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
try {
|
||||
return new BigDecimal(value.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
// 辅助方法:安全地将字符串转换为Long
|
||||
@JsonIgnore
|
||||
private Long parseLong(String value) {
|
||||
if (value == null || value.trim().isEmpty()) {
|
||||
return 0L;
|
||||
}
|
||||
try {
|
||||
return Long.parseLong(value.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
// 转换方法,返回数值类型
|
||||
@JsonIgnore
|
||||
public Long getSerialNumberAsLong() {
|
||||
return parseLong(serialNumber);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getBasicSalaryAsDecimal() {
|
||||
return parseDecimal(basicSalary);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getPostSalaryAsDecimal() {
|
||||
return parseDecimal(postSalary);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getMealAllowanceAsDecimal() {
|
||||
return parseDecimal(mealAllowance);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getHousingAllowanceAsDecimal() {
|
||||
return parseDecimal(housingAllowance);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getBusAllowanceAsDecimal() {
|
||||
return parseDecimal(busAllowance);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Long getBusinessDaysOtherAsLong() {
|
||||
return parseLong(businessDaysOther);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getBusinessAllowanceAsDecimal() {
|
||||
return parseDecimal(businessAllowance);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getSocialSecurityAllowanceAsDecimal() {
|
||||
return parseDecimal(socialSecurityAllowance);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getOvertimeHoursAsDecimal() {
|
||||
return parseDecimal(overtimeHours);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getOvertimeRateAsDecimal() {
|
||||
return parseDecimal(overtimeRate);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getOvertimeTotalAsDecimal() {
|
||||
return parseDecimal(overtimeTotal);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Long getBusinessDaysAsLong() {
|
||||
return parseLong(businessDays);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getLeaveDeductionAsDecimal() {
|
||||
return parseDecimal(leaveDeduction);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getOtherDeductionAsDecimal() {
|
||||
return parseDecimal(otherDeduction);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getGrossSalaryAsDecimal() {
|
||||
return parseDecimal(grossSalary);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getPersonalPensionAsDecimal() {
|
||||
return parseDecimal(personalPension);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getPersonalMedicalAsDecimal() {
|
||||
return parseDecimal(personalMedical);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getPersonalUnemploymentAsDecimal() {
|
||||
return parseDecimal(personalUnemployment);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getPersonalBigMedicalAsDecimal() {
|
||||
return parseDecimal(personalBigMedical);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getPersonalHousingFundAsDecimal() {
|
||||
return parseDecimal(personalHousingFund);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getPersonalTaxAsDecimal() {
|
||||
return parseDecimal(personalTax);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getNetSalaryAsDecimal() {
|
||||
return parseDecimal(netSalary);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getEnterprisePensionAsDecimal() {
|
||||
return parseDecimal(enterprisePension);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getEnterpriseMedicalAsDecimal() {
|
||||
return parseDecimal(enterpriseMedical);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getEnterpriseInjuryAsDecimal() {
|
||||
return parseDecimal(enterpriseInjury);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getEnterpriseUnemploymentAsDecimal() {
|
||||
return parseDecimal(enterpriseUnemployment);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getEnterpriseMaternityAsDecimal() {
|
||||
return parseDecimal(enterpriseMaternity);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getEnterpriseHousingFundAsDecimal() {
|
||||
return parseDecimal(enterpriseHousingFund);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getEnterpriseBigMedicalAsDecimal() {
|
||||
return parseDecimal(enterpriseBigMedical);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public BigDecimal getUnitTotalExpenseAsDecimal() {
|
||||
return parseDecimal(unitTotalExpense);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user