| | |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | |
| | | import static com.ruoyi.common.enums.StaffJoinLeaveRecordDimissionReason.StaffJoinLeaveRecordDimissionReasonOther; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | staffOnJobMapper.updateById(staffOnJob); |
| | | }else { |
| | | throw new BaseException("没有找到"+staffJoinLeaveRecord.getStaffNo()+"编号的员工,无法新增离职!!!"); |
| | | } |
| | | if (staffJoinLeaveRecord.getDimissionReason()==null){ |
| | | throw new BaseException("离职原因不能为空!!!"); |
| | | } |
| | | if (!StaffJoinLeaveRecordDimissionReasonOther.getCode().equals(staffJoinLeaveRecord.getDimissionReason())){ |
| | | staffJoinLeaveRecord.setDimissionRemark(""); |
| | | } |
| | | } |
| | | return staffJoinLeaveRecordMapper.insert(staffJoinLeaveRecord); |
| | |
| | | /*入职*/ |
| | | StaffOnJob job = staffOnJobMapper.selectList(Wrappers.<StaffOnJob>lambdaQuery() |
| | | .eq(StaffOnJob::getStaffNo, staffJoinLeaveRecord.getStaffNo())).get(0); |
| | | // 增加了合同方案所以去掉这个判断 |
| | | //如果更改的合同到期时间更久则更新,如果没有就不用更新 |
| | | if (staffJoinLeaveRecord.getContractEndTime().compareTo(job.getContractExpireTime())>0) { |
| | | // if (staffJoinLeaveRecord.getContractEndTime().compareTo(job.getContractExpireTime())>0) { |
| | | // BeanUtils.copyProperties(staffJoinLeaveRecord,job,ignoreProperties); |
| | | // staffOnJobMapper.updateById(job); |
| | | // } |
| | | if(job != null){ |
| | | BeanUtils.copyProperties(staffJoinLeaveRecord,job,ignoreProperties); |
| | | staffOnJobMapper.updateById(job); |
| | | } |
| | | }else { |
| | | /*离职*/ |
| | | //离职的编辑不会影响在职表 |
| | | if (staffJoinLeaveRecord.getDimissionReason()==null){ |
| | | throw new BaseException("离职原因不能为空!!!"); |
| | | } |
| | | if (!StaffJoinLeaveRecordDimissionReasonOther.getCode().equals(staffJoinLeaveRecord.getDimissionReason())){ |
| | | staffJoinLeaveRecord.setDimissionRemark(""); |
| | | } |
| | | } |
| | | return staffJoinLeaveRecordMapper.updateById(staffJoinLeaveRecord); |
| | | } |