|
|
|
|
@ -12,10 +12,8 @@ import cn.iocoder.yudao.module.mes.controller.admin.orgworker.vo.OrgWorkerPageRe
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.orgworker.vo.OrgWorkerRespVO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.orgworker.vo.OrgWorkerSaveReqVO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.producereport.vo.ProduceReportDetailSaveReqVO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.workteam.vo.WorkTeamUserRoleEnum;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.orgworker.OrgWorkerDO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.workteam.WorkTeamDetailDO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.organization.OrganizationService;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.orgworker.OrgWorkerService;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.workteam.WorkTeamService;
|
|
|
|
|
@ -35,12 +33,10 @@ import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
|
|
|
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
|
|
|
@Tag(name = "管理后台 - 工位安排")
|
|
|
|
|
@RestController
|
|
|
|
|
@ -143,20 +139,6 @@ public class OrgWorkerController {
|
|
|
|
|
return success(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**个人报工,用户列表**/
|
|
|
|
|
@GetMapping("/getPersonalUser")
|
|
|
|
|
@Operation(summary = "获得用户列表")
|
|
|
|
|
public CommonResult<List<AdminUserRespDTO>> getPersonalUser() {
|
|
|
|
|
|
|
|
|
|
Long userId = getLoginUserId();
|
|
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
|
|
ids.add(userId);
|
|
|
|
|
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(ids);
|
|
|
|
|
List<AdminUserRespDTO> userRespDTOS = new ArrayList<>();
|
|
|
|
|
if(userMap.containsKey(userId))
|
|
|
|
|
userRespDTOS.add(userMap.get(userId));
|
|
|
|
|
return success(userRespDTOS);
|
|
|
|
|
}
|
|
|
|
|
/**代替报工,用户列表**/
|
|
|
|
|
@GetMapping("/getOtherPersonalUser")
|
|
|
|
|
@Operation(summary = "获得用户列表")
|
|
|
|
|
@ -195,18 +177,6 @@ public class OrgWorkerController {
|
|
|
|
|
pageReqVO.setWorkDate(DateUtils.getDateRange(reqVO.getReportDate()));
|
|
|
|
|
pageReqVO.setWorkerId(reqVO.getUserId());
|
|
|
|
|
|
|
|
|
|
Long userId = getLoginUserId();
|
|
|
|
|
List<WorkTeamDetailDO> detailDOList = workTeamService.getUserWorkTeamDetail(userId, WorkTeamUserRoleEnum.组长.getValue());
|
|
|
|
|
//组长的话把这些组的工人列表都查上,其他人所有人都查
|
|
|
|
|
List<Long> workTeamIds =null;
|
|
|
|
|
if(detailDOList!=null && detailDOList.size()>0){
|
|
|
|
|
workTeamIds = detailDOList.stream().map(WorkTeamDetailDO::getWorkTeamId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
List<WorkTeamDetailDO> workTeamDetailDOS = workTeamService.getDetailByWorkTeamIds(workTeamIds);
|
|
|
|
|
Set<Long> idsSet = convertSet(workTeamDetailDOS, WorkTeamDetailDO::getUserId);
|
|
|
|
|
if(idsSet!=null && idsSet.size()>0){
|
|
|
|
|
pageReqVO.setWorkerIds(new ArrayList<>(idsSet));
|
|
|
|
|
}
|
|
|
|
|
List<OrgWorkerDO> orgWorkers = orgWorkerService.getOrgWorkerByReportResVo(pageReqVO);
|
|
|
|
|
|
|
|
|
|
return success(orgWorkerService.buildVOList(orgWorkers));
|
|
|
|
|
|