From 42e68faca0756d44b7c880c9876810ee47d6e92b Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期一, 17 二月 2025 17:57:25 +0800 Subject: [PATCH] 1.DNC模块,设备结构树权限分配优化与修改bug 2.MDC模块,设备编辑车间同步平移设备send目录 3.优化原有指派设备代码 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java | 11 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java | 22 + lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java | 5 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupPermissionServiceImpl.java | 4 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java | 9 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java | 24 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DncCopyEquipment.java | 45 +++ lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java | 588 +++++++++++++++++++++++------------------------- lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcUserProductionServiceImpl.java | 2 10 files changed, 393 insertions(+), 325 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java index 9e4f927..a17b68e 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java @@ -194,150 +194,37 @@ @Override @Transactional(rollbackFor = {Exception.class}) public boolean applyAssignFileActive(AssignFileStream stream) { - //鏍¢獙寮�濮� - if(stream == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - 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); - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - if(!ValidateUtil.validateString(userId)) - ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - //淇敼涓哄墠绔紶鍏� - 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()); - if(deviceInfo == null) - ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); - if(deviceInfo == null) - ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); + validateParams(stream); + DocInfo docInfo = getDocInfo(stream); + MdcEquipment mdcEquipment = getMdcEquipment(stream); DocFile docFile = docFileService.getById(stream.getFileId()); DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); - if(deviceDoc != null) { - /*// 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� - List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), - docFile.getFileName(), docFile.getFileSuffix()); - if (!copyFileNc) { - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - } else { - //docInfoService.getBaseMapper().deleteById(deviceDoc.getDocId()); - boolean doc = docRelativeService.deleteDocByAttr(deviceDoc.getDocId(),4,stream.getDeviceId()); - if (!doc) { - ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); - } - } - }*/ + if (deviceDoc != null) { + handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId()); } deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); - if(deviceDoc != null) { - // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� - /* List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), - docFile.getFileName(), docFile.getFileSuffix()); - if (!copyFileNc) { - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - } else { - //docInfoService.getBaseMapper().deleteById(deviceDoc.getDocId()); - boolean doc = docRelativeService.deleteDocByAttr(deviceDoc.getDocId(),4,stream.getDeviceId()); - if (!doc) { - ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); - } - } - }*/ + if (deviceDoc != null) { + handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId()); } - - ProcessStream processStream = processStreamService.getById(stream.getProcessId()); - if(processStream == null) - ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_SAVE_ERROR); - stream.setProductId(processStream.getProductId()); - stream.setComponentId(processStream.getComponentId()); - stream.setPartsId(processStream.getPartsId()); - List<PermissionStream> permissionStreams = null; - if(ValidateUtil.validateString(processStream.getPartsId())) { - //杩涘叆闆朵欢 - permissionStreams = permissionStreamService.getByPartsId(stream.getProductId(), stream.getComponentId(), stream.getPartsId()); - }else if(ValidateUtil.validateString(processStream.getComponentId())) { - //杩涘叆閮ㄤ欢鐨勫鐞� - permissionStreams = permissionStreamService.getByComponentId(stream.getProductId(), stream.getComponentId()); - } - 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()); - } - }); - if(departIds.isEmpty()) - ExceptionCast.cast(ActivitiCode.ACT_USER_NOT_PERM); - //鑾峰彇閮ㄩ棬瀹℃壒浜� - List<String> userIdList = definitionService.getByDepartIds(departIds); - if(userIdList == null || userIdList.isEmpty()) - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); - //鏍¢獙缁撴潫 - String streamId = IdWorker.getIdStr(); - stream.setStreamId(streamId); - stream.setApplyUserId(userId); - stream.setApplyTime(DateUtil.getNow()); - stream.setStatus(1); - //淇濆瓨娴佺▼涓氬姟瀵硅薄 - boolean b = super.save(stream); - if(!b) - ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_SAVE_ERROR); - //淇濆瓨娴佺▼浠诲姟 - String approveUsers = String.join(",", userIdList); - Map<String, Object> avariableMap = new HashMap<>(); - avariableMap.put(APPLY_VARIABLE, userId); - avariableMap.put(APPROVE_VARIABLE, approveUsers); - //鍚姩娴佺▼ - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_KEY, streamId, avariableMap); - if(processInstance == null) - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); - //鏌ヨ褰撳墠娴佺▼鐢ㄦ埛娴佺▼浠诲姟 - Task task = taskService.createTaskQuery().processDefinitionKey(PROCESS_KEY).taskAssignee(userId) - .processInstanceId(processInstance.getId()).singleResult(); - if(task == null) - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); - //瀹屾垚娴佺▼浠诲姟 - taskService.complete(task.getId()); + List<PermissionStream> permissionStreams = getPermissionStreams(stream); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + List<String> departIds = getDepartIds(permissionStreams, userId); + List<String> userIdList = getUserIdList(departIds); + saveBusinessObject(stream, userId); + ProcessInstance processInstance = startProcessInstance(stream, userIdList); + completeTask(processInstance, userId); return true; } @Override @Transactional(rollbackFor = {Exception.class}) public ResponseResult applyAssignFileNonActive(AssignFileStream stream) { - if(stream == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - 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); - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - if(!ValidateUtil.validateString(userId)) - ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - DocInfo docInfo = docInfoService.getByDocAttrAndDocId(stream.getDocId(), Integer.parseInt(stream.getAttributionType()), stream.getAttributionId()); - if(docInfo == null || docInfo.getDocStatus() == 3) - ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); - - MdcEquipment mdcEquipment = iMdcEquipmentService.getById(stream.getDeviceId()); -// DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId()); - if(mdcEquipment == null) - ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); - DocFile docFile = docFileService.getById(stream.getFileId()); - if(docFile == null) - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + //鏉冮檺鏍¢獙 + validateParams(stream); + DocInfo docInfo = getDocInfo(stream); + MdcEquipment mdcEquipment = getMdcEquipment(stream); + DocFile docFile = getDocFile(stream); DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); if(deviceDoc != null) { // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� @@ -348,7 +235,6 @@ docFile.getFileName(), docFile.getFileSuffix()); } } - /*deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); if(deviceDoc != null) { // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� @@ -359,73 +245,12 @@ docFile.getFileName(), docFile.getFileSuffix()); } }*/ - 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())) { - //杩涘叆闆朵欢 - permissionStreams = permissionStreamService.getByPartsId(stream.getProductId(), stream.getComponentId(), stream.getPartsId()); - }else if(ValidateUtil.validateString(processStream.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()); - } - }); - }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()); - /*if(deviceDoc != null) - ExceptionCast.cast(ActivitiCode.ACT_DEVICE_DOC_ERROR);*/ + getPermissionStreams(stream); //鎻掑叆鏂囨。鍒拌澶囧彂閫佹枃妗� if(deviceDoc == null) { DocClassification classification = classificationService.getByCode(SEND_CODE); if(classification == null) ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); - DocRelative docRelative = new DocRelative(); docRelative.setDocId(docInfo.getDocId()); docRelative.setClassificationId(classification.getClassificationId()); @@ -437,121 +262,8 @@ } } - - //TODO - //鎻掑叆鏂囦欢浼犺緭浠诲姟琛� - List<String> strings=iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(), - docFile.getFileEncodeName(), - docFile.getFileName(),docFile.getFileSuffix()); - if (!copyFileNc) { - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - } else { - FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(), - docFile.getFileName(),docFile.getFileSuffix()); - - } - } else { - return new ResponseResult(CommonCode.FAIL); - } - String size = FileUtilS.fileSizeNC(docFile.getFilePath(),docFile.getFileEncodeName()); - if (whether.equals("true") && !docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar") ) { - //澶勭悊鏂囦欢 璁板綍骞朵笂鎶� - //1銆� 鍒ゆ柇绔彛鏄惁鑳藉璁块棶 鏂囦欢璺緞鍔� - /*boolean btelnetPort = TelnetUtil.telnetPort(serverIp,serverPort,10); - if (!btelnetPort) { - ExceptionCast.cast(ActivitiCode.ACT_DEVICE_DOC_FILELABLE); - }*/ - DncPassLog passInfoTxt = new DncPassLog(); - - String path = StringUtils.join(strings.toArray(), "/"); - Date dateFirst = DateUtil.getNow(); - passInfoTxt.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); - /*鏌ヨ鏈�鍚庝竴鏉¤褰�*/ - //浼戠湢 500姣 - DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); - Integer fileTxt = 0, fileNc =0; - if (dncPassLog !=null) { - fileTxt = dncPassLog.getSequenceNumber() + 1; - fileNc = fileTxt + 1; - } else { - fileTxt = 1; - fileNc = fileTxt + 1; - } - //澶勭悊鏂囦欢鍚嶇О 鏂囦欢璺緞 - String sequence = String.format("%06d",fileTxt); - String sequenceNc = String.format("%06d",fileNc); - passInfoTxt.setSequenceNumber(fileTxt); - passInfoTxt.setSequenceOrder(sequence); - passInfoTxt.setCreateTime(dateFirst); - System.out.println(DateUtil.format(dateFirst,DateUtil.STR_DATE_TIME)); - passInfoTxt.setPassType("02"); - dncPassLogService.save(passInfoTxt); - - DncPassLog passInfoNc = new DncPassLog(); - passInfoNc.setSequenceNumber(fileNc); - passInfoNc.setSequenceOrder(sequenceNc); - passInfoNc.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); - passInfoNc.setPassType("02"); - passInfoNc.setPassName(docFile.getFileName()); - try { - Thread.sleep(1000); - Date date = new Date(); - passInfoNc.setCreateTime(date); - System.out.println(DateUtil.format(date,DateUtil.STR_DATE_TIME)); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - dncPassLogService.save(passInfoNc); - - NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); - ncTxt.setEquipmentId(mdcEquipment.getEquipmentId()); - ncTxt.setFileNcName("02A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequenceNc); - ncTxt.setFileTxtName("02A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequence); - ncTxt.setFilePath(path + "/"+ mdcEquipment.getEquipmentId() + "/" ); - ncTxt.setOrigFileName(docFile.getFileName()); - ncTxt.setOrigFileSuffix(docFile.getFileSuffix()); - ncTxt.setFileAddOrDelete(1); - String loFilePath = localFilePath + ncTxt.getFileTxtName() + ".nc"; -// String loFilePath = localFilePath + "\\" + ncTxt.getFileTxtName() + ".nc"; - try { - String allList = new String(); - allList=(ncTxt.getFileTxtName()+"\n"); - allList+=(ncTxt.getFileNcName()+"\n"); - allList+=(ncTxt.getOrigFileName()+"\n"); - allList+=(ncTxt.getOrigFileSuffix()+"\n"); - allList+=(ncTxt.getFilePath()+"\n"); - allList+=(ncTxt.getEquipmentId()+"\n"); - allList+=(ncTxt.getFileAddOrDelete().toString()+"\n"); - // 鏂囦欢澶у皬瀛楄妭 绗簩琛� 宸ユ帶缃戣繘琛屾枃浠跺垎鏋� - allList+= (size+"\n"); - - FileUtilS.fileWriterSql(loFilePath,allList); - //鏂囦欢瑙f瀽閲嶆柊瑙勫垝 - //娣诲姞鏂囦欢鍚嶅瓧锛岀涓�琛岋紝 - - -/* - boolean copyFileNc = FileUtilS.copyFileNcIntegration(path + "/"+ deviceInfo.getDeviceNo() +"/send/" + - docFile.getFileName(), - localFilePath + "\\" + ncTxt.getFileNcName(), - docFile.getFileSuffix()); -*/ - boolean copyFileNc = FileUtilS.copyFileUpName(path + "/"+ mdcEquipment.getEquipmentId() +"/send/" + - docFile.getFileName(), - localFilePath + ncTxt.getFileNcName(), -// localFilePath + "\\" + ncTxt.getFileNcName(), - docFile.getFileSuffix(),"NC"); - if (!copyFileNc) { - FileUtilS.deleteNcFile(loFilePath); - } - } catch (IOException e) { - e.printStackTrace(); - } - } + handleFileTransfer(mdcEquipment, docFile); + handleFileProcessing(docFile, mdcEquipment, whether, localFilePath); synchronizedFlagService.updateFlag(2); return new ResponseResult(CommonCode.SUCCESS); } @@ -848,4 +560,258 @@ } return synchronizedFlagService.updateFlag(1); } + + //浼犲弬楠岃瘉 + private void validateParams(AssignFileStream stream) { + if (stream == null) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + 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); + } + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if (!ValidateUtil.validateString(userId)) { + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + } + } + + //鑾峰彇鏂囦欢淇℃伅 + private DocInfo getDocInfo(AssignFileStream stream) { + DocInfo docInfo = docInfoService.getByDocAttrAndDocId(stream.getDocId(), Integer.parseInt(stream.getAttributionType()), stream.getAttributionId()); + if (docInfo == null || docInfo.getDocStatus() == 3) { + ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); + } + return docInfo; + } + + //鑾峰彇鏂囦欢 + private void handleExistingDeviceDoc(DocFile docFile, MdcEquipment mdcEquipment, String deviceId) { + List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getEquipmentId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/" + mdcEquipment.getEquipmentId(), + docFile.getFileName(), docFile.getFileSuffix()); + if (!copyFileNc) { + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + } else { + DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(deviceId, 4, deviceId); + boolean doc = docRelativeService.deleteDocByAttr(deviceDoc.getDocId(), 4, deviceId); + if (!doc) { + ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); + } + } + } + } + + //鏉冮檺鏍¢獙 + private List<PermissionStream> getPermissionStreams(AssignFileStream stream) { + List<PermissionStream> permissionStreams = 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(processStream.getProcessId()); + permissionStreams = permissionStreamService + .getByProcessId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(), processStream.getProcessId()); + } 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.setStepId(workStep.getId()); + permissionStreams = permissionStreamService + .getByStepId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId(), workStep.getProcessId(), workStep.getId()); + } + if (permissionStreams == null || permissionStreams.isEmpty()) { + ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); + } + return permissionStreams; + } + + //鑾峰彇閮ㄩ棬淇℃伅 + //todo 淇敼 + private List<String> getDepartIds(List<PermissionStream> permissionStreams, String userId) { + Map<String, Department> map = departmentService.getMapByUserId(userId); + List<String> departIds = permissionStreams.stream() + .filter(item -> map.containsKey(item.getDepartId())) + .map(PermissionStream::getDepartId) + .collect(Collectors.toList()); + if (departIds.isEmpty()) { + ExceptionCast.cast(ActivitiCode.ACT_USER_NOT_PERM); + } + return departIds; + } + + //鑾峰彇澶氫釜閮ㄩ棬鐨勫鎵逛汉 鍘婚噸 + private List<String> getUserIdList(List<String> departIds) { + List<String> userIdList = definitionService.getByDepartIds(departIds); + if (userIdList == null || userIdList.isEmpty()) { + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); + } + return userIdList; + } + + //灏佽鏁版嵁 + private void saveBusinessObject(AssignFileStream stream, String userId) { + String streamId = IdWorker.getIdStr(); + stream.setStreamId(streamId); + stream.setApplyUserId(userId); + stream.setApplyTime(DateUtil.getNow()); + stream.setStatus(1); + boolean b = super.save(stream); + if (!b) { + ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_SAVE_ERROR); + } + } + + //寮�濮嬪伐浣滄祦 + private ProcessInstance startProcessInstance(AssignFileStream stream, List<String> userIdList) { + String approveUsers = String.join(",", userIdList); + Map<String, Object> avariableMap = new HashMap<>(); + avariableMap.put(APPLY_VARIABLE, stream.getApplyUserId()); + avariableMap.put(APPROVE_VARIABLE, approveUsers); + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_KEY, stream.getStreamId(), avariableMap); + if (processInstance == null) { + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); + } + return processInstance; + } + + //鎷惧彇浠诲姟 + private void completeTask(ProcessInstance processInstance, String userId) { + Task task = taskService.createTaskQuery().processDefinitionKey(PROCESS_KEY).taskAssignee(userId) + .processInstanceId(processInstance.getId()).singleResult(); + if (task == null) { + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); + } + taskService.complete(task.getId()); + } + + //鑾峰彇璁惧 + private MdcEquipment getMdcEquipment(AssignFileStream stream) { + MdcEquipment mdcEquipment = iMdcEquipmentService.getById(stream.getDeviceId()); + if (mdcEquipment == null) { + ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); + } + return mdcEquipment; + } + + //鑾峰彇鏂囦欢 + private DocFile getDocFile(AssignFileStream stream) { + DocFile docFile = docFileService.getById(stream.getFileId()); + if (docFile == null) { + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + } + return docFile; + } + + //鎻掑叆鏂囦欢浼犺緭浠诲姟琛� + private void handleFileTransfer(MdcEquipment mdcEquipment, DocFile docFile) { + List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(), path + "/" + mdcEquipment.getEquipmentId(), + docFile.getFileEncodeName(), + docFile.getFileName(), docFile.getFileSuffix()); + if (!copyFileNc) { + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + } else { + FileUtilS.deleteZipFromToSend(path + "/" + mdcEquipment.getEquipmentId(), + docFile.getFileName(), docFile.getFileSuffix()); + } + } else { + throw new RuntimeException("鏂囦欢浼犺緭璺緞鑾峰彇澶辫触"); + } + } + + //灏佽澶勭悊鏂囦欢 + private void handleFileProcessing(DocFile docFile, MdcEquipment mdcEquipment, String whether, String localFilePath) { + if (whether.equals("true") && !docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) { + String size = FileUtilS.fileSizeNC(docFile.getFilePath(), docFile.getFileEncodeName()); + List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + Date dateFirst = DateUtil.getNow(); + DncPassLog passInfoTxt = new DncPassLog(); + passInfoTxt.setDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); + DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); + Integer fileTxt = 0, fileNc = 0; + if (dncPassLog != null) { + fileTxt = dncPassLog.getSequenceNumber() + 1; + fileNc = fileTxt + 1; + } else { + fileTxt = 1; + fileNc = fileTxt + 1; + } + String sequence = String.format("%06d", fileTxt); + String sequenceNc = String.format("%06d", fileNc); + passInfoTxt.setSequenceNumber(fileTxt); + passInfoTxt.setSequenceOrder(sequence); + passInfoTxt.setCreateTime(dateFirst); + passInfoTxt.setPassType("02"); + dncPassLogService.save(passInfoTxt); + + DncPassLog passInfoNc = new DncPassLog(); + passInfoNc.setSequenceNumber(fileNc); + passInfoNc.setSequenceOrder(sequenceNc); + passInfoNc.setDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); + passInfoNc.setPassType("02"); + passInfoNc.setPassName(docFile.getFileName()); + try { + Thread.sleep(1000); + Date date = new Date(); + passInfoNc.setCreateTime(date); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + dncPassLogService.save(passInfoNc); + + NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); + ncTxt.setEquipmentId(mdcEquipment.getEquipmentId()); + ncTxt.setFileNcName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY) + sequenceNc); + ncTxt.setFileTxtName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY) + sequence); + ncTxt.setFilePath(path + "/" + mdcEquipment.getEquipmentId() + "/"); + ncTxt.setOrigFileName(docFile.getFileName()); + ncTxt.setOrigFileSuffix(docFile.getFileSuffix()); + ncTxt.setFileAddOrDelete(1); + String loFilePath = localFilePath + ncTxt.getFileTxtName() + ".nc"; + try { + String allList = ncTxt.getFileTxtName() + "\n" + + ncTxt.getFileNcName() + "\n" + + ncTxt.getOrigFileName() + "\n" + + ncTxt.getOrigFileSuffix() + "\n" + + ncTxt.getFilePath() + "\n" + + ncTxt.getEquipmentId() + "\n" + + ncTxt.getFileAddOrDelete().toString() + "\n" + + size + "\n"; + FileUtilS.fileWriterSql(loFilePath, allList); + boolean copyFileNc = FileUtilS.copyFileUpName(path + "/" + mdcEquipment.getEquipmentId() + "/send/" + + docFile.getFileName(), + localFilePath + ncTxt.getFileNcName(), + docFile.getFileSuffix(), "NC"); + if (!copyFileNc) { + FileUtilS.deleteNcFile(loFilePath); + } + } catch (IOException e) { + throw new RuntimeException("鏂囦欢澶勭悊澶辫触", e); + } + } + } + } + } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java index d0b7f0c..a639bbc 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java @@ -86,6 +86,17 @@ List<PermissionStream> getByProcessId(String productId, String componentId, String partsId, String processId); /** + * 鏍规嵁宸ユ缂栧彿鏌ユ壘閮ㄩ棬鏉冮檺 + * @param productId + * @param componentId + * @param partsId + * @param processId + * @param stepId + * @return + */ + List<PermissionStream> getByStepId(String productId, String componentId, String partsId,String processId,String stepId); + + /** * 鍒犻櫎鐢ㄦ埛鏉冮檺 * @param productId * @return diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupPermissionServiceImpl.java index 63f5d37..274744e 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupPermissionServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupPermissionServiceImpl.java @@ -144,10 +144,6 @@ permissionStreamList.add(stream); } }); - //鏍¢獙娓呯┖璁惧鍒嗙粍鏉冮檺鎿嶄綔 - List<MdcUserProduction> existList = mdcUserProductionService.list(new QueryWrapper<MdcUserProduction>().eq("pro_id",mdcProduction.getId())); - if(existList.size() <= mdcUserProductions.size()) - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_USER_NONE); if(!mdcUserProductions.isEmpty()) { boolean b = mdcUserProductionService.removeByCollection(mdcUserProductions); if(!b) { diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java index bb59e16..c75b3d9 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java @@ -298,14 +298,14 @@ ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); } //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� - List<MdcProduction> childrenList = mdcProductionService.queryProdByPid(mdcProduction.getId()); + List<MdcProduction> childrenList = mdcProductionService.recursionChildrenByPid(mdcProduction.getId()); List<String> childrenIds = new ArrayList<>(); if(childrenList != null && !childrenList.isEmpty()) { childrenList.forEach(item -> { childrenIds.add(item.getId()); boolean b = checkDevicePerm(1, item.getId()); if(b) { - b = deviceGroupPermissionService.assignAddUser(mdcProduction, userList); + b = deviceGroupPermissionService.assignAddUser(item, userList); if(!b) { ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); } @@ -488,14 +488,14 @@ ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); } //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� - List<MdcProduction> childrenList = mdcProductionService.queryProdByPid(mdcProduction.getId()); + List<MdcProduction> childrenList = mdcProductionService.recursionChildrenByPid(mdcProduction.getId()); List<String> childrenIds = new ArrayList<>(); if(childrenList != null && !childrenList.isEmpty()) { childrenList.forEach(item -> { childrenIds.add(item.getId()); boolean b = checkDevicePerm(1, item.getId()); if(b) { - b = deviceGroupPermissionService.assignRemoveUser(mdcProduction, userList); + b = deviceGroupPermissionService.assignRemoveUser(item, userList); if(!b) { ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java index 9f8de34..b5011d4 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java @@ -138,12 +138,24 @@ @Override public List<PermissionStream> getByProcessId(String productId, String componentId, String partsId, String processId){ - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId) - || !ValidateUtil.validateString(partsId) || !ValidateUtil.validateString(processId)) + List<PermissionStream> list = super.lambdaQuery() + .eq(StrUtil.isNotEmpty(productId),PermissionStream::getProductId, productId) + .eq(StrUtil.isNotEmpty(componentId),PermissionStream::getComponentId, componentId) + .eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId) + .eq(StrUtil.isNotEmpty(processId),PermissionStream::getProcessId,processId).list(); + if(list == null || list.isEmpty()) return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). - isNull(PermissionStream::getUserId).eq(PermissionStream::getComponentId, componentId) - .eq(PermissionStream::getPartsId, partsId).eq(PermissionStream::getProcessId,processId).list(); + return list; + } + + @Override + public List<PermissionStream> getByStepId(String productId, String componentId, String partsId,String processId,String stepId){ + List<PermissionStream> list = super.lambdaQuery() + .eq(StrUtil.isNotEmpty(productId),PermissionStream::getProductId, productId) + .eq(StrUtil.isNotEmpty(componentId),PermissionStream::getComponentId, componentId) + .eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId) + .eq(StrUtil.isNotEmpty(processId),PermissionStream::getProcessId,processId) + .eq(StrUtil.isNotEmpty(stepId),PermissionStream::getStepId,stepId).list(); if(list == null || list.isEmpty()) return null; return list; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java index 39fc70b..66a807d 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java @@ -25,6 +25,7 @@ import org.jeecg.modules.mdc.model.MdcEquipmentTree; import org.jeecg.modules.mdc.service.*; import org.jeecg.modules.mdc.util.DateUtils; +import org.jeecg.modules.mdc.util.DncCopyEquipment; import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil; import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil; import org.jeecg.modules.mdc.vo.*; @@ -34,14 +35,19 @@ import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper; import org.jeecg.modules.system.service.*; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -99,6 +105,9 @@ @Resource private DncDevicePermissionMapper dncDevicePermissionMapper; + + @Value("${fileNCPath}") + private String fileNCPath; @Override @@ -194,6 +203,14 @@ break; } } + //骞崇Щ璁惧鐩綍涓嬬幇鏈夌粨鏋勪笌鏂囦欢 + //鑾峰彇鍘熸湁缁撴瀯 + String OldPath=""; + String NewPath=""; + List<String> OldStrings=mdcProductionService.findListParentTreeAll(mdcEquipment.getId()); + if (OldStrings != null && !OldStrings.isEmpty()) { + OldPath = fileNCPath+"/"+StringUtils.join(OldStrings.toArray(), "/")+"/"+mdcEquipment.getEquipmentId(); + } //step.1 淇敼璁惧鍩虹淇℃伅 this.updateById(mdcEquipment); //step.2 淇敼閮ㄩ棬 @@ -226,6 +243,13 @@ mdcProductionEquipmentMapper.insert(productionEquipment); } } + List<String> NewStrings = mdcProductionService.findListParentTreeAll(mdcEquipment.getId()); + if (NewStrings != null && !NewStrings.isEmpty()) { + NewPath = fileNCPath+"/"+StringUtils.join(NewStrings.toArray(), "/")+"/"+mdcEquipment.getEquipmentId(); + } + // 骞崇ЩOldPath涓嬬殑鏂囦欢鍒癗ewPath涓� + DncCopyEquipment.CopyEquipmentPath(OldPath,NewPath); + //淇濆瓨璁惧瀵瑰簲鐨勪骇绾挎潈闄� addDevicePermission(mdcEquipment); //step.4 淇敼璁惧鏉冮檺 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DncCopyEquipment.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DncCopyEquipment.java new file mode 100644 index 0000000..fc5199d --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DncCopyEquipment.java @@ -0,0 +1,45 @@ +package org.jeecg.modules.mdc.util; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; + +/*** + * DNC骞崇Щ璁惧杞﹂棿宸ュ叿绫� + */ +public class DncCopyEquipment { + + public static void CopyEquipmentPath(String OldPath,String NewPath){ + if (!OldPath.equals(NewPath)) { + File oldDir = new File(OldPath); + File newDir = new File(NewPath); + // 鍒涘缓鏂扮洰褰� + if (!newDir.exists()) { + if (!newDir.mkdirs()) { + System.err.println("鏃犳硶鍒涘缓鏂扮洰褰�: " + NewPath); + return; + } + } + // 閬嶅巻鏃х洰褰曚笅鐨勬墍鏈夋枃浠跺拰瀛愮洰褰� + if (oldDir.exists() && oldDir.isDirectory()) { + File[] files = oldDir.listFiles(); + if (files != null) { + for (File file : files) { + try { + File destFile = new File(newDir, file.getName()); + // 澶嶅埗鏂囦欢 + Files.copy(file.toPath(), destFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + System.err.println("鏂囦欢骞崇Щ杩囩▼涓嚭鐜伴敊璇�: " + e.getMessage()); + } + } + } + } + // 鍒犻櫎鏃х洰褰� + if (!oldDir.delete()) { + System.err.println("鍒犻櫎鍘熺洰褰曞け璐�: " + oldDir); + } + } + } +} diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java index df9cba2..4f8f510 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java @@ -61,6 +61,11 @@ List<MdcProduction> queryProdByPid(String pid); /** + * 閫掑綊鏌ヨ鎵�鏈夊瓙鑺傜偣 + */ + List<MdcProduction> recursionChildrenByPid(String pid); + + /** * 鏍规嵁鐢ㄦ埛id鑾峰彇浜х嚎涓嬫媺鏍戦�夐」 */ List<ProductionIdModel> loadProductionTreeOptions(String userId); diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java index 2ca696b..9aca7fc 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java @@ -196,6 +196,15 @@ } /** + * 閫掑綊鏌ヨ鎵�鏈夊瓙鑺傜偣 + */ + @Override + public List<MdcProduction> recursionChildrenByPid(String pid){ + List<String> ids=this.recursionChildren(pid); + return super.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).in(MdcProduction::getId, ids)); + } + + /** * 鏍规嵁鐢ㄦ埛id鑾峰彇浜х嚎涓嬫媺鏍戦�夐」 */ @Override diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcUserProductionServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcUserProductionServiceImpl.java index a293443..bbe3b74 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcUserProductionServiceImpl.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcUserProductionServiceImpl.java @@ -131,7 +131,7 @@ @Override public MdcUserProduction getByUserIdAndGroupId(String userId, String proId){ - if(StrUtil.isNotEmpty(userId) || !StrUtil.isNotEmpty(proId)) + if(StrUtil.isEmpty(userId) || StrUtil.isEmpty(proId)) return null; List<MdcUserProduction> list = super.lambdaQuery().eq(MdcUserProduction::getUserId, userId).eq(MdcUserProduction::getProId, proId).list(); if(list == null || list.isEmpty()) -- Gitblit v1.9.3