| | |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.deepoove.poi.config.ConfigureBuilder; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.personnel.dto.PersonJobResponsibilitiesDto; |
| | | import com.ruoyi.personnel.mapper.PersonJobResponsibilitiesMapper; |
| | | import com.ruoyi.personnel.pojo.PersonJobResponsibilities; |
| | |
| | | |
| | | @Override |
| | | public void exportPersonJobResponsibilities(Integer id, HttpServletResponse response) { |
| | | if (id == null) { |
| | | throw new ErrorException("缺少岗位职责id"); |
| | | } |
| | | PersonJobResponsibilities personJobResponsibilities = baseMapper.selectById(id); |
| | | if (personJobResponsibilities == null) { |
| | | throw new ErrorException("岗位职责不存在或已被删除"); |
| | | } |
| | | if (ObjectUtils.isEmpty(personJobResponsibilities.getIncumbentId())) { |
| | | throw new ErrorException("该岗位职责还没有选择任职人,暂无法导出"); |
| | | } |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日"); |
| | | //岗位名称 |
| | | String name = personJobResponsibilities.getPostName(); |
| | | Integer incumbentUserId = Integer.parseInt(personJobResponsibilities.getIncumbentId()); |
| | | //所属部门 |
| | | String departLims = userMapper.selectUserDepartmentLimsName(Integer.parseInt(personJobResponsibilities.getIncumbentId())); |
| | | String departLims = userMapper.selectUserDepartmentLimsName(incumbentUserId); |
| | | //工作目标 |
| | | String objective = personJobResponsibilities.getJobObjective(); |
| | | //岗位职责 |
| | | String responsibilities = personJobResponsibilities.getJobResponsibilities(); |
| | | //任职人 |
| | | User user = userMapper.selectById(Integer.parseInt(personJobResponsibilities.getIncumbentId())); |
| | | User user = userMapper.selectById(incumbentUserId); |
| | | if (user == null) { |
| | | throw new ErrorException("任职人不存在或已被删除,请重新选择任职人"); |
| | | } |
| | | String incumbent = user.getName(); |
| | | //任职时间 |
| | | String incumbentDate = ""; |
| | |
| | | //主管 |
| | | String supervisor = ""; |
| | | if (ObjectUtils.isNotEmpty(personJobResponsibilities.getSupervisorId())) { |
| | | supervisor = userMapper.selectById(personJobResponsibilities.getSupervisorId()).getName(); |
| | | User supervisorUser = userMapper.selectById(personJobResponsibilities.getSupervisorId()); |
| | | supervisor = supervisorUser != null ? supervisorUser.getName() : ""; |
| | | } |
| | | //主管时间 |
| | | String supervisorDate = ""; |