| | |
| | | package com.ruoyi.staff.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.mapper.StaffLeaveMapper; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.service.StaffLeaveService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.staff.pojo.StaffLeave; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @AllArgsConstructor |
| | | @Service |
| | | public class StaffLeaveServiceImpl extends ServiceImpl<StaffLeaveMapper, StaffLeave> implements StaffLeaveService { |
| | | @Autowired |
| | | private StaffLeaveMapper staffLeaveMapper; |
| | | |
| | | @Autowired |
| | | private StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | //新增离职列表分页查询 |
| | | @Override |
| | |
| | | // 新增离职记录 |
| | | StaffLeave staffLeave = new StaffLeave(); |
| | | staffLeave.setStaffOnJobId(staffLeaveDto.getStaffOnJobId()); |
| | | staffLeave.setReason(staffLeaveDto.getReason()); |
| | | String reason = staffLeaveDto.getReason(); |
| | | if (!StaffLeaveReasonOther.getCode().equals(reason)){ |
| | | staffLeave.setRemark(""); |
| | | if (StaffLeaveReasonOther.getCode().equals(reason)){ |
| | | staffLeave.setRemark(staffLeaveDto.getRemark()); |
| | | } |
| | | staffLeaveMapper.insert(staffLeave); |
| | | |
| | | // 更新对应用户状态为停用 |
| | | // 根据员工编号查询用户 |
| | | SysUser sysUser = sysUserMapper.selectUserByUserName(staffOnJob.getStaffNo()); |
| | | sysUser.setStatus("1"); |
| | | sysUserMapper.updateUser(sysUser); |
| | | |
| | | // 更新离职状态为离职 |
| | | staffOnJob.setStaffState(0); |
| | |
| | | ExcelUtil<StaffLeaveDto> util = new ExcelUtil<StaffLeaveDto>(StaffLeaveDto.class); |
| | | util.exportExcel(response, staffLeaves, "员工离职导出"); |
| | | } |
| | | |
| | | } |
| | | |