| | |
| | | private String secretFolder; //涉密网传输nc文件夹 |
| | | @Autowired |
| | | private FileFerryService ferryService; |
| | | @Autowired |
| | | private IDocClassificationService iDocClassificationService; |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result applyAssignFile(AssignFileStream stream) { |
| | | public Result<?> applyAssignFile(AssignFileStream stream) { |
| | | synchronized (this){ |
| | | //判断设备特殊字符 |
| | | String specialChar = getDeviceSpecialChar(stream.getDeviceId(),stream.getFileId()); |
| | | if (StrUtil.isNotEmpty(specialChar)){ |
| | | //抛出特殊字符异常 |
| | | return Result.error("文件名称存在设备特殊字符"); |
| | | } |
| | | //查询文档的状态,批准状态才可以指派 |
| | | DocInfo docInfo=getDocInfo(stream); |
| | | DocClassification docClassification=iDocClassificationService.getById(docInfo.getClassificationId()); |
| | | if (docInfo.getDocDispatchStatus()!=null&&docInfo.getDocDispatchStatus()!=3&&docInfo.getDocDispatchStatus()!=5&&docClassification.getClassificationCode().equals("nc")){ |
| | | return Result.error("该文件状态不允许指派,请先完成审签流程"); |
| | | } |
| | | if(flowableEnable) { |
| | | return applyAssignFileActive(stream); |
| | |
| | | DocFile docFile = docFileService.getById(stream.getFileId()); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 7, stream.getDeviceId()); |
| | | if (deviceDoc != null) { |
| | | handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId()); |
| | | handleExistingDeviceDoc(docInfo,docFile, mdcEquipment, stream.getDeviceId()); |
| | | } |
| | | deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 7, stream.getDeviceId()); |
| | | if (deviceDoc != null) { |
| | | handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId()); |
| | | handleExistingDeviceDoc(docInfo,docFile, mdcEquipment, stream.getDeviceId()); |
| | | } |
| | | PermissionStreamNew permissionStreams = getPermissionStreams(stream); |
| | | if (permissionStreams==null){ |
| | |
| | | String userId = user.getId(); |
| | | saveBusinessObject(stream, userId); |
| | | System.out.println("指派NC文档到设备流程:" + stream.getDocId()); |
| | | flowCommonService.initActBusiness("指派NC文档到设备流程:" +docInfo.getDocName()+"."+docInfo.getDocSuffix()+"到设备->"+mdcEquipment.getEquipmentName() , |
| | | flowCommonService.initActBusiness("指派NC文档到设备流程:" +docInfo.getDocName()+"."+docInfo.getDocSuffix()+"到设备->"+mdcEquipment.getEquipmentId() , |
| | | stream.getStreamId(), "IAssignFileStreamService", "assign_nc_to_device", null); |
| | | Map<String, Object> variables = new HashMap<>(); |
| | | variables.put("dataId", stream.getStreamId()); |
| | |
| | | } |
| | | handleFileTransfer(mdcEquipment, docFile); |
| | | //NC文件的拷贝 |
| | | handleFileProcessing(docFile, mdcEquipment, secretFolder); |
| | | // handleFileProcessing(docFile, mdcEquipment, secretFolder); |
| | | //对应产品结构树拷贝 |
| | | handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId()); |
| | | // handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId()); |
| | | synchronizedFlagService.updateFlag(2); |
| | | return Result.OK("操作成功"); |
| | | } |
| | |
| | | //涉密网进行NC文件的拷贝 |
| | | handleFileTransfer(mdcEquipment, docFile); |
| | | //NC文件的拷贝 |
| | | handleFileProcessing(docFile, mdcEquipment, secretFolder); |
| | | // handleFileProcessing(docFile, mdcEquipment, secretFolder); |
| | | //对应产品结构树拷贝 |
| | | handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId()); |
| | | // handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId()); |
| | | return synchronizedFlagService.updateFlag(1); |
| | | }else if(up.getStatus() == 3) { |
| | | //拒绝操作 什么也不做 |
| | |
| | | } |
| | | |
| | | //获取文件 |
| | | private void handleExistingDeviceDoc(DocFile docFile, MdcEquipment mdcEquipment, String deviceId) { |
| | | private void handleExistingDeviceDoc(DocInfo docInfo,DocFile docFile, MdcEquipment mdcEquipment, String deviceId) { |
| | | List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | | 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); |
| | | ExceptionCast.cast(ActivitiCode.ACT_DEVICE_DOC_ERROR); |
| | | } else { |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(deviceId, 7, deviceId); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(docInfo.getDocId(), 7, deviceId); |
| | | boolean doc = docRelativeService.deleteDocByAttr(deviceDoc.getDocId(), 7, deviceId); |
| | | if (!doc) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); |