feat(salary): 添加批量发放薪资功能
- 在 GearSalaryRecordsBo 中添加 employeeIds 字段用于存储员工 ID 数组 - 在 GearSalaryRecordsController 中添加 batchSendSalary 接口 - 在 GearSalaryRecordsServiceImpl 中实现 batchSendSalary 方法 - 在 IGearSalaryRecordsService 中添加 batchSendSalary 接口定义
This commit is contained in:
@@ -99,4 +99,13 @@ public class GearSalaryRecordsController extends BaseController {
|
||||
@PathVariable Long[] salaryIds) {
|
||||
return toAjax(iGearSalaryRecordsService.deleteWithValidByIds(Arrays.asList(salaryIds), true));
|
||||
}
|
||||
|
||||
//批量发送薪资
|
||||
@Log(title = "批量发送薪资", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/batchSendSalary")
|
||||
public R<Void> batchSendSalary(@Validated(EditGroup.class) @RequestBody GearSalaryRecordsBo bo) {
|
||||
return toAjax(iGearSalaryRecordsService.batchSendSalary(bo));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.util.Date;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
|
||||
@@ -93,6 +95,7 @@ public class GearSalaryRecordsBo extends BaseEntity {
|
||||
* 发放状态
|
||||
*/
|
||||
private String payStatus;
|
||||
|
||||
//employee_id数组
|
||||
private List<Long> employeeIds;
|
||||
|
||||
}
|
||||
|
||||
@@ -46,4 +46,6 @@ public interface IGearSalaryRecordsService {
|
||||
* 校验并批量删除工资发放记录信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
int batchSendSalary(GearSalaryRecordsBo bo);
|
||||
}
|
||||
|
||||
@@ -140,4 +140,27 @@ public class GearSalaryRecordsServiceImpl implements IGearSalaryRecordsService {
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchSendSalary(GearSalaryRecordsBo bo) {
|
||||
//从bo里面获取员工id以及时间和各种费用
|
||||
GearSalaryRecords gearSalaryRecords = new GearSalaryRecords();
|
||||
for (Long employeeId : bo.getEmployeeIds()){
|
||||
gearSalaryRecords.setEmployeeId(employeeId);
|
||||
gearSalaryRecords.setPayPeriod(bo.getPayPeriod());
|
||||
gearSalaryRecords.setBaseSalary(bo.getBaseSalary());
|
||||
gearSalaryRecords.setPerformanceBonus(bo.getPerformanceBonus());
|
||||
gearSalaryRecords.setOvertimePay(bo.getOvertimePay());
|
||||
gearSalaryRecords.setAllowance(bo.getAllowance());
|
||||
gearSalaryRecords.setSocialSecurity(bo.getSocialSecurity());
|
||||
gearSalaryRecords.setHousingFund(bo.getHousingFund());
|
||||
gearSalaryRecords.setIncomeTax(bo.getIncomeTax());
|
||||
gearSalaryRecords.setGrossSalary(bo.getGrossSalary());
|
||||
gearSalaryRecords.setNetSalary(bo.getNetSalary());
|
||||
gearSalaryRecords.setPayStatus("paid"); // 默认设置为已支付
|
||||
baseMapper.insert(gearSalaryRecords);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user