| | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.hrm.api.employee.HrmEmployeeApi; |
| | | import cn.iocoder.yudao.module.hrm.api.employee.dto.HrmEmployeeSimpleRespDTO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.md.workstation.vo.worker.MesMdWorkstationEmployeeRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.md.workstation.vo.worker.MesMdWorkstationWorkerRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.md.workstation.vo.worker.MesMdWorkstationWorkerSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationWorkerDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationWorkerService; |
| | | import cn.iocoder.yudao.module.system.api.dept.PostApi; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.PostRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | private PostApi postApi; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | private HrmEmployeeApi hrmEmployeeApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "创建人力资源") |
| | |
| | | @GetMapping("/list-by-workstation") |
| | | @Operation(summary = "获得人力资源列表") |
| | | @Parameter(name = "workstationId", description = "工作站编号", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:md-workstation:query')") |
| | | public CommonResult<List<MesMdWorkstationWorkerRespVO>> getWorkstationWorkerList( |
| | | @RequestParam("workstationId") Long workstationId) { |
| | | List<MesMdWorkstationWorkerDO> list = workstationWorkerService.getWorkstationWorkerListByWorkstationId(workstationId); |
| | |
| | | } |
| | | |
| | | @GetMapping("/list-user-by-workstation") |
| | | @Operation(summary = "获得工作站对应岗位的员工列表") |
| | | @Operation(summary = "获得工作站对应岗位的员工列表(取自员工管理数据,不要求开通系统账号)") |
| | | @Parameter(name = "workstationId", description = "工作站编号", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:md-workstation:query')") |
| | | public CommonResult<List<AdminUserRespDTO>> getUserListByWorkstation( |
| | | public CommonResult<List<MesMdWorkstationEmployeeRespVO>> getUserListByWorkstation( |
| | | @RequestParam("workstationId") Long workstationId) { |
| | | List<MesMdWorkstationWorkerDO> list = workstationWorkerService.getWorkstationWorkerListByWorkstationId(workstationId); |
| | | if (CollUtil.isEmpty(list)) { |
| | |
| | | if (CollUtil.isEmpty(postIds)) { |
| | | return success(Collections.emptyList()); |
| | | } |
| | | List<AdminUserRespDTO> userList = adminUserApi.getUserListByPostIds(postIds); |
| | | return success(userList); |
| | | List<HrmEmployeeSimpleRespDTO> employees = hrmEmployeeApi.getEmployeeListByPostIds(postIds); |
| | | List<MesMdWorkstationEmployeeRespVO> result = new ArrayList<>(employees.size()); |
| | | for (HrmEmployeeSimpleRespDTO employee : employees) { |
| | | MesMdWorkstationEmployeeRespVO vo = new MesMdWorkstationEmployeeRespVO(); |
| | | vo.setId(employee.getId()); |
| | | vo.setNickname(employee.getName()); |
| | | vo.setDeptId(employee.getDeptId()); |
| | | vo.setPhone(employee.getPhone()); |
| | | result.add(vo); |
| | | } |
| | | return success(result); |
| | | } |
| | | |
| | | // ==================== 拼接 VO ==================== |