Method and system for storing and integrating engineering industry filesTechnical Field
The invention relates to the technical field of engineering file processing, in particular to a method and a system for storing and integrating files in engineering industry.
Background
At present, the engineering industry documents have the characteristics of multiple types, multiple numbers, large documents, low use frequency and the like. The project is scattered, the file is uploaded, and the searching and the use are difficult. Various third party systems such as business, office and the like also need file uploading, so that the files are stored in a scattered mode, management is complex, and archiving is inconvenient.
The professional storage file equipment NAS (Network Attached Storage, network access server/network storage server) can solve the centralized storage and search of files, but if the professional storage file equipment NAS is integrated with a third-party system of a company, different systems are required to be customized and developed, the integration threshold is high, and the professional storage file equipment NAS has no universality.
Although the searching and using speed of the documents is faster through the Windows interface and the directory mode, and the documents are more in line with the habit of the user, if Windows is adopted as the file storage device directly, the documents cannot be integrated with the third party system or the cost is high due to the fact that the corresponding API interface is not available.
Disclosure of Invention
In order to solve the problems, the invention provides a method and a system for storing and integrating files in engineering industry, which are characterized in that communication software is deployed on a file server, a file directory is read through the communication software, and the file directory is output in a JSON format, so that the communication software is used as a bridge of a third party system. And the third party system communicates with the file server through the communication software to realize file reading, and meanwhile, operation habits such as file localization (local area network) access, addition and deletion are reserved.
The technical scheme adopted by the invention is as follows:
a method of engineering industry file storage and integration, comprising:
reading a file: acquiring a NAS (network attached storage) based on communication software, namely a file and a directory stored in a network storage server, and packaging the NAS into a JSON object;
file integration: and the third party system acquires corresponding file and directory paths from the communication software according to service requirements, returns JSON data and performs analysis, display, association and storage.
Further, the file reading comprises the following sub-steps:
s101, communication software accesses a Servlet interface of a network storage server and generates a secret key;
s102, comparing the generated secret key with the secret key brought by the URL, and if the comparison is consistent, executing the next step; otherwise, the access is not authorized;
s103, acquiring files and catalogs stored in the network storage server through the File object, and packaging the files and the catalogs into the JSON object.
Further, the file reading is developed based on a security access policy, wherein the security access policy comprises a security access policy based on an IP white list and an encryption policy based on an MD5 message digest algorithm.
Further, the security access policy based on the IP whitelist includes: and the third party system sets a trust list, and requests from IP addresses in the trust list are all passed.
Further, the encryption policy based on the MD5 message digest algorithm includes: the third party system generates a salted MD5 string, the salted MD5 string is transmitted into communication software through a URL, the communication software generates the MD5 string according to the same rule, and access is allowed if the salted MD5 string and the communication software are equal to each other, otherwise, the access is failed.
Further, the method for generating the salt value in the encryption strategy based on the MD5 message digest algorithm comprises the following steps: a 32-bit random number is generated per hour and put into a remote dictionary service Redis for integrated sharing of third party systems and communication software.
Further, a non-ROOT user is created in the network storage server for file reading of the communication software, the user only having the right to access the files and directories required by the application.
Further, before the file is read, the network storage server configures a directory which is forbidden to be read, and performs forbidden access setting on the directory which cannot be checked externally.
Further, the file integration includes the steps of:
s201, a service system server accesses communication software through an HttpClient tool to acquire a file and a directory path corresponding to service requirements and returns JSON data;
s202, analyzing the JSON data, and displaying, correlating and storing the analyzed file.
The engineering industry file storage and integration system comprises a memory and a processor, wherein the memory stores communication software, and the processor realizes the engineering industry file storage and integration method when running the communication software.
The invention has the beneficial effects that:
(1) The engineering industry file storage and integration system provided by the invention can enable the third party system and the network storage server to be independent of each other, and are not mutually interfered and destroyed.
(2) If the third party system needs to integrate NAS files, the third party system directly accesses an http interface address (the address is listed as a document and a subordinate directory of the NAS) provided by communication software, and associates the documents or the directories.
(3) If the third party system needs to check the file, the associated directory is directly opened, or the associated directory is copied to the computer to perform localized access of the file.
(4) The invention fully utilizes the characteristics of NAS mass storage, localized deployment, full file search, document compatibility opening and the like, and has low cost and simple and convenient integration into a third-party system.
(5) The communication software in the invention can be directly used in a file server based on Windows besides NAS storage equipment as a connecting bridge of the file and a third party system, so that the low-frequency storage and integration problems of large files in engineering industry can be solved with lower cost.
Drawings
Fig. 1 is an API-based integration pattern diagram.
FIG. 2 is a NAS device file storage example.
FIG. 3 is a schematic diagram of a method for engineering industry file storage and integration in accordance with an embodiment of the present invention.
FIG. 4 is a flow chart of file reading according to an embodiment of the present invention.
FIG. 5 is a flow chart of file integration according to an embodiment of the present invention.
Detailed Description
Specific embodiments of the present invention will now be described in order to provide a clearer understanding of the technical features, objects and effects of the present invention. It should be understood that the particular embodiments described herein are illustrative only and are not intended to limit the invention, i.e., the embodiments described are merely some, but not all, of the embodiments of the invention. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to be within the scope of the present invention.
Example 1
NAS (Network Attached Storage, network access server/network storage server) is a specialized document storage device that is inexpensive and simple to operate. As a storage product, the NAS provides an API interface of OAuth2.0 specification, and a third party system can secondarily develop through the interface to realize the operation of files and catalogs so as to form a document calling mode shown in figure 1.
However, this mode has the following problems: 1. the integration threshold is high; 2. the technology support available for domestic development is limited; 3. deep coupling with third party systems is detrimental to decoupling or replacement of storage schemes. In practice, therefore, the NAS exists as a standalone storage device, in isolation from third party systems.
The use of directly using a Windows server as file storage is also common, and the integration of the file storage and a service system is not completed because of no API interface.
The mainstream NAS devices are Linux operating systems, and files of the mainstream NAS devices all adopt a directory storage mode similar to that of a Windows operating system, as shown in fig. 2. The file storage format has the following characteristics: 1. the operating style is consistent with Windows; 2. the file name or the directory is in a plaintext form, is not coded, and can be directly operated on by using development technology.
Based on this, as shown in fig. 3, the present embodiment provides a method for storing and integrating engineering industry files, including:
reading a file: acquiring a NAS (network attached storage) based on communication software, namely a file and a directory stored in a network storage server, and packaging the NAS into a JSON object;
file integration: and the third party system acquires corresponding file and directory paths from the communication software according to service requirements, returns JSON data and performs analysis, display, association and storage.
The file reading can be performed in any language, and Java development technology is preferable in view of portability and platform independence of the system.
Preferably, as shown in fig. 4, the file reading includes the following sub-steps:
s101, communication software accesses a Servlet interface of a network storage server and generates a secret key;
s102, comparing the generated secret key with the secret key brought by the URL, and if the comparison is consistent, executing the next step; otherwise, the access is not authorized;
s103, acquiring files and catalogs stored in the network storage server through the File object, and packaging the files and the catalogs into the JSON object.
The following points need to be noted in file reading:
the key point 1 is as follows: the directory that prohibits reading needs to be configured: and performing forbidden and prevented setting on the catalogue which cannot be externally checked. A function is developed defining a directory to which access is prohibited.
And (2) the key points are as follows: java language development and Tomcat deployed system architecture are recommended.
And (3) the key points are as follows: the interface data is saved in JSON format, where JSON format is as follows:
[ { "name": "File name 1", "length": "File number 1", "url": "File Path 1" },
{ "name": "File name 2", "length": "File number 2", "url": "File Path 2" },
{ "name": "File name 3", "length": "File number 3", "url": "File Path 3" })
To increase the security of file reading, this embodiment provides two security access policies:
(1) Security access policy based on IP whitelist: the third party system sets a credit list, and requests from IP addresses in the credit list are all passed.
(2) Encryption policy based on MD5 message digest algorithm: the third party system generates a salted MD5 string, the salted MD5 string is transmitted into communication software through a URL, the communication software generates the MD5 string according to the same rule, and access is allowed if the salted MD5 string and the communication software are equal to each other, otherwise, the access is failed. The salt value generating method can be as follows: a 32-bit random number (the key value rule is that the time of year, month and day is the number of the 32-bit random number) is generated every hour and put into a remote dictionary service Redis for integrated sharing of a third party system and communication software.
Since the files in the hard disk are directly read, security of the network storage server needs to be considered. Preferably, a non-ROOT user is created in the network storage server for file reading of the communication software, the user having only the rights to access the files and directories required by the application.
Preferably, as shown in fig. 5, the file integration includes the steps of:
s201, a service system server accesses communication software through an HttpClient tool to acquire a file and a directory path corresponding to service requirements and returns JSON data;
s202, analyzing the JSON data, and displaying, correlating and storing the analyzed file.
More preferably, the present embodiment provides two file display modes:
(1) Client side display in local area network: copying the whole path of the bound file in a third party system, pasting the copied path on the address bar of the my computer, and enabling the user to quickly open the file or enter the file directory by returning.
(2) And (3) displaying by a Web terminal: the file is opened directly (consistent with a traditional online preview file) based on the interface address of the communication software.
Example 2
This example is based on example 1:
an engineering industry file storage and integration system comprises a memory and a processor, wherein the memory stores communication software, and the processor realizes the engineering industry file storage and integration method of the embodiment 1 when the communication software is operated. The communication software may be in the form of source code, object code, executable files, some intermediate form, or the like.
The foregoing is merely a preferred embodiment of the invention, and it is to be understood that the invention is not limited to the form disclosed herein but is not to be construed as excluding other embodiments, but is capable of numerous other combinations, modifications and environments and is capable of modifications within the scope of the inventive concept, either as taught or as a matter of routine skill or knowledge in the relevant art. And that modifications and variations which do not depart from the spirit and scope of the invention are intended to be within the scope of the appended claims.