| | |
| | | @Autowired |
| | | private IProcessStreamService processStreamService; |
| | | @Autowired |
| | | private IWorkStepService workStepService; |
| | | @Autowired |
| | | private IPermissionStreamService permissionStreamService; |
| | | @Autowired |
| | | private IDepartmentService departmentService; |
| | |
| | | //校验开始 |
| | | if(stream == null) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | if(!ValidateUtil.validateString(stream.getProcessId()) || !ValidateUtil.validateString(stream.getDocId()) |
| | | || !ValidateUtil.validateString(stream.getFileId())) |
| | | if(!ValidateUtil.validateString(stream.getAttributionId()) || !ValidateUtil.validateString(stream.getDocId()) |
| | | || !ValidateUtil.validateString(stream.getFileId())||!ValidateUtil.validateString(stream.getAttributionType()) ) |
| | | ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_SAVE_ERROR); |
| | | if(!ValidateUtil.validateString(stream.getDeviceId())) |
| | | ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); |
| | |
| | | String userId = user.getId(); |
| | | if(!ValidateUtil.validateString(userId)) |
| | | ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); |
| | | DocInfo docInfo = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 5, stream.getProcessId()); |
| | | //修改为前端传入 |
| | | DocInfo docInfo = docInfoService.getByDocAttrAndDocId(stream.getDocId(), Integer.parseInt(stream.getAttributionType()), stream.getAttributionId()); |
| | | if(docInfo == null || docInfo.getDocStatus() == 3) |
| | | ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); |
| | | DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId()); |
| | |
| | | public ResponseResult applyAssignFileNonActive(AssignFileStream stream) { |
| | | if(stream == null) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | if(!ValidateUtil.validateString(stream.getProcessId()) || !ValidateUtil.validateString(stream.getDocId()) |
| | | || !ValidateUtil.validateString(stream.getFileId())) |
| | | if(!ValidateUtil.validateString(stream.getAttributionId()) || !ValidateUtil.validateString(stream.getDocId()) |
| | | || !ValidateUtil.validateString(stream.getFileId())||!ValidateUtil.validateString(stream.getAttributionType())) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | if(!ValidateUtil.validateString(stream.getDeviceId())) |
| | | ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); |
| | |
| | | String userId = user.getId(); |
| | | if(!ValidateUtil.validateString(userId)) |
| | | ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); |
| | | DocInfo docInfo = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 5, stream.getProcessId()); |
| | | DocInfo docInfo = docInfoService.getByDocAttrAndDocId(stream.getDocId(), Integer.parseInt(stream.getAttributionType()), stream.getAttributionId()); |
| | | if(docInfo == null || docInfo.getDocStatus() == 3) |
| | | ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); |
| | | |
| | |
| | | docFile.getFileName(), docFile.getFileSuffix()); |
| | | } |
| | | }*/ |
| | | ProcessStream processStream = processStreamService.getById(stream.getProcessId()); |
| | | List<String> departIds = new ArrayList<>(); |
| | | if (stream.getAttributionType().equals("5")){ |
| | | //工序 |
| | | ProcessStream processStream = processStreamService.getById(stream.getAttributionId()); |
| | | if(processStream == null) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | stream.setProductId(processStream.getProductId()); |
| | | stream.setComponentId(processStream.getComponentId()); |
| | | stream.setPartsId(processStream.getPartsId()); |
| | | stream.setProcessId(stream.getAttributionId()); |
| | | List<PermissionStream> permissionStreams = null; |
| | | if(ValidateUtil.validateString(processStream.getPartsId())) { |
| | | //进入零件 |
| | |
| | | } |
| | | if(permissionStreams == null || permissionStreams.isEmpty()) |
| | | ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); |
| | | List<String> departIds = new ArrayList<>(); |
| | | Map<String, Department> map = departmentService.getMapByUserId(userId); |
| | | permissionStreams.forEach(item -> { |
| | | if(map.containsKey(item.getDepartId())) { |
| | | departIds.add(item.getDepartId()); |
| | | } |
| | | }); |
| | | }else{ |
| | | //工步 |
| | | WorkStep workStep=workStepService.getById(stream.getAttributionId()); |
| | | if(workStep == null) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | stream.setProductId(workStep.getProductId()); |
| | | stream.setComponentId(workStep.getComponentId()); |
| | | stream.setPartsId(workStep.getPartsId()); |
| | | stream.setProcessId(workStep.getProcessId()); |
| | | stream.setProcessId(stream.getAttributionId()); |
| | | List<PermissionStream> permissionStreams = null; |
| | | if(ValidateUtil.validateString(workStep.getProcessId())) { |
| | | //进入工序 |
| | | permissionStreams=permissionStreamService.getByProcessId(stream.getProductId(), stream.getComponentId(), stream.getPartsId(),stream.getProcessId()); |
| | | }else if(ValidateUtil.validateString(workStep.getPartsId())) { |
| | | //进入零件 |
| | | permissionStreams = permissionStreamService.getByPartsId(stream.getProductId(), stream.getComponentId(), stream.getPartsId()); |
| | | }else if(ValidateUtil.validateString(workStep.getComponentId())) { |
| | | //进入部件的处理 |
| | | permissionStreams = permissionStreamService.getByComponentId(stream.getProductId(), stream.getComponentId()); |
| | | } |
| | | if(permissionStreams == null || permissionStreams.isEmpty()) |
| | | ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); |
| | | Map<String, Department> map = departmentService.getMapByUserId(userId); |
| | | permissionStreams.forEach(item -> { |
| | | if(map.containsKey(item.getDepartId())) { |
| | | departIds.add(item.getDepartId()); |
| | | } |
| | | }); |
| | | } |
| | | if(departIds.isEmpty()) |
| | | ExceptionCast.cast(ActivitiCode.ACT_USER_NOT_PERM); |
| | | //deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); |