lyh
2025-02-14 f2f8241dd52ef12ec109f6f4f0f13042055338ac
lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java
@@ -71,6 +71,8 @@
    @Autowired
    private IProcessStreamService processStreamService;
    @Autowired
    private IWorkStepService workStepService;
    @Autowired
    private IPermissionStreamService permissionStreamService;
    @Autowired
    private IDepartmentService departmentService;
@@ -195,8 +197,8 @@
        //校验开始
        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);
@@ -204,7 +206,8 @@
        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());
@@ -315,8 +318,8 @@
    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);
@@ -324,7 +327,7 @@
        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);
@@ -356,12 +359,16 @@
                        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())) {
            //进入零件
@@ -372,13 +379,42 @@
        }
        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());