Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Transactional
- public Workplace edit(Workplace workplace, Boolean isWorkplaceAsPayrollGroup, Boolean isWorkplaceAsAttendanceGroup) {
- valWorkplaceRequired(workplace);
- valRequiredBoolean(isWorkplaceAsPayrollGroup, "completeWorkplace.workplaceAsPayrollGroup.required");
- valRequiredBoolean(isWorkplaceAsAttendanceGroup, "completeWorkplace.workplaceAsAttendanceGroup.required");
- throwBatchError();
- Workplace oldWorkplace = workplaceService.find(workplace.getId()).orElse(null);
- PayrollGroup oldPayrollGroup = payrollGroupService.findByBk(oldWorkplace.getName()).orElse(null);
- AttendanceGroup oldAttendanceGroup = attendanceGroupService.findByBk(oldWorkplace.getCode()).orElse(null);
- workplace = workplaceService.edit(workplace);
- if (isWorkplaceAsPayrollGroup) {
- if (payrollGroup != null) {
- payrollGroup.setPayrollGroupName(workplace.getName());
- payrollGroupService.edit(payrollGroup);
- }
- }
- if (isWorkplaceAsAttendanceGroup) {
- if (attendanceGroup != null) {
- attendanceGroup.setCode(workplace.getCode());
- attendanceGroup.setName(workplace.getName());
- attendanceGroupService.edit(attendanceGroup);
- }
- }
- return workplace;
- }
Advertisement
Add Comment
Please, Sign In to add comment