Design and Implementation of WeChat Mini Program for
University Dormitory Based on SOA
Jiawei Wang, Wenhao Wang and Quanyin Zhu,China(5号,宋体,段前0段后0.5)
According to the actual demand of management on university dormitory, a WeChat mini program for university dormitory based on SOA which makes teachers and students manage dormitory conveniently and efficiently is proposed. The Web-Service is adopted to encapsulate back-end functions into a series of services for front-end calls. The WeChat mini program is used as a front-end development carrier to realize the management functions of university dormitory. Experiments show that the proposed system is stable and the working efficiency is greatly increased. The results show that the application system can capture the requirements of student dormitory management, with good scalability.
一、Introduction
Student dormitory management, the important component of school running, with traditional artificial management mode, is nearly impossible for teachers and students to carry out effective management. In order to solve the management problems caused by the change of dormitory requirements in universities, the management system of student dormitory is implemented with the mode of agile development in reference [2] . Thinking about the management system based on ERP (Enterprise Resources Planning), the information platform of CPR digital campus is put forward in reference to realize the integration of dormitory information resources [3]. The dormitory management information system based on the basic principle of MIS is constructed by the C/ S model and Delphi development tools .
Service-Oriented Architecture (SOA) is a type of software design that can combine services into applications [5]. In reference [6], the idea of registering standardized metadata through SOA is proposed, and then a statistical metadata computing system based on SOA is developed.
WeChat mini programs are sub-applications within WeChat where WeChat users can easily gain access to other apps. Compared with mobile apps [7] [8], WeChat mini programs can be used without downloading and installing, and the user interface and operation flow can be unified [9].
Based on our past work [10-12], we use service-oriented viewpoints to analyze and integrate the heterogeneous system integration. The dormitory information of Huaiyin Institute of Technology is taken as the research object. The WeChat mini program is used to connect users and services, and provide diversified campus functions to implement dormitory management. In the second part, we construct the structure of the university dormitory management system. The SOA technology used in the system is introduced in the third part. In the fourth part, we introduce the WeChat mini program for university dormitory management. In the fifth part, we come to the conclusion.
二、System Architecture
The software architecture design of the university dormitory management system using ServiceOriented Architecture technology can encapsulate multiple systems into services [13]. The system is mainly composed of server layer, middleware layer, WeChat mini program layer and client layer fourlayer structure.
Server layer stores database, data interfaces and Web server data; Middleware layer is responsible for data acquisition and exchange between the server and the WeChat mini program; WeChat mini program layer provides front-end interface and operational data processing; Client layer allows users to access the WeChat mini program for university dormitory arrangement by searching or scanning QR code.
The system functions include user information management, dormitory evaluation management, water and electricity management, maintenance management, dormitory daily affairs management, card management, student examination arrangement and score query, etc
三、 Analysis and Design Based on SOA
There are many different websites for the daily management of university dormitories. Visit each website needs to be authenticated and waiting for the website to respond, which is not only a waste of time but also reduces the efficiency of dormitory management. In addition, the user data distributed in the server costs software workers a lot of time, and too scattered user data is not conducive to statistics and management. Traditional languages such as Java mainly represent objects as classes [14], while users generally focus on software functions and take functional services as interfaces. Therefore, SOA is closer to the needs of users.
In the view of the low coupling and high scalability of SOA, we integrate the service object, functional structure and process relationship on the basis of the existing independent university system. What we need to pay attention to is the call of each service interface, without involving the underlying programming interface and understanding the specific implementation of the underlying service.
The idea of hierarchical division is applied in the system. The whole system is divided into the presentation layer, business process layer, service layer, system layer and data layer.
The design of the system SOA structure can be divided into the following five layers:
Presentation Layer. Mainly responsible for the front-end interface of dormitory management system through the WeChat mini program. The interface can be flexibly configured according to different users.
Business Process Layer. Responsible for listening and monitoring Web Service services published by service providers [15]. The requests sent from different business systems can be processed in time, and then the corresponding service modules will be properly dispatched to ensure the normal operation of the system.
Service Layer. Composed of a series of service models. The systems that need to be called in the dormitory management are encapsulated into a unified standard for service interaction specification. When the service layer receives the request sent by the business process layer, the service module can be flexibly divided and assembled, then the business component will be transformed into a service model, and finally the corresponding request is completed. If other university business systems need to interact with the dormitory management system, they can operate directly at the service layer. Only need to do is to follow the uniform standard interface for data acquisition. We do not need to be concerned about the need for the technology used by the third-party systems.
System Layer. Aimed at integrating systems related to daily dormitory arrangement, such as university educational administration system, student affairs department system, university personnel management system, university financial management system.
Data Layer. Mainly responsible for storing and managing data, including user database and system database.
The architecture has good generality and scalability. Through applying the above architecture, the functions and business components in the system application can be extracted
四、Wechat Mini Programs
4.1. Advantages of WeChat Mini Programs
B/S structure has difficulty realizing individualized functions and requires the support of browsers, while C/S structure limits the extension of system functions and software upgrades. WeChat mini programs make up for the shortcomings of the above two structure. The system not only improves the user experience but also speeds up the loading of the dormitory management system. WeChat mini programs are more efficient for users and more cost-efficient with limited capability compared with native mobile applications. WeChat mini programs are built with a special framework which is based on JavaScript designed by Tencent.
4.2. Technical Implementation
The framework of the WeChat mini program for university dormitory is mainly divided into view layer (View) and logic layer (App Service). Among them, the view layer is used to render the page, constructed by wxml files and wxss files. The logic layer written in JavaScript is used to handle transactions, request network, and process data. Data transmission and event systems are provided to the view layer and the logic layer.
4.2.1. Data Interaction with Local Cache.
The data locally generated by the user can be persisted. When a user logs in the mini program, the home page “index” will call the getUser () function in the app.js. The function calls the wx.setStorage() to store the data returned after the successful login in the specified key of the local cache
if(!_this.cache || _this.cache != res.data.data){
wx.setStorage({
key: "cache",
data: res.data.data
});
_this.processData(res.data.data);
}
Finally, the function processData () is invoked to further parse the stored data through JSON, and then return the data.
processData: function(key){
var _this = this;
var data
=JSON.parse(_this.util.base64.decode(key));
_this._user.is_bind = data.is_bind;
_this._user.openid = data.user.openid;
_this._user.teacher = data.user.type == 'teacher';
_this._user.we = data.user;
_this._t = data['\x74\x6f\x6b\x65\x6e'];
return data;
}
The “cache” corresponding to the key can be synchronously acquired from the local cache through wx.getStorageSync(). wx.clearStorage() will be called to asynchronously remove “cache” if the user fails to log in or the HTTP request is wrong.
4.2.2. Data Interaction with Server.
The data exchanges between the WeChat mini program for dormitory management and background data are Http Requests and Web Socket connections. The format for data exchange is JSON, which can be easily parsed by the client side [13].
The process of the data interaction is as follows:
In order to reduce the impact of network latency, the WeChat mini program loads the JSON data provided by the server when teachers and students enter the system;
When teachers and students access the dormitory information data, WeChat API wx.request is called to request data from the server;
The data requested by the WeChat mini program is processed by the server and then the JSON data will be sent through the Web Socket connection;
When teachers and students have finished, the synchronization data will be submitted to server and in other cases will be processed in the memory of the WeChat mini program
五. Conclusion
In this paper, the concept of SOA is adopted to integrate multiple independent university information systems to realize the direct interaction of services and data sharing. Therefore, a university dormitory management system based on SOA is proposed. Taking system performance and user experience into account, the WeChat mini program is considered as the front-end development carrier. The dormitory arrangement system based on the WeChat mini program is a light program that does not need to be downloaded or installed. Teachers and students can open the application by scanning the QR code or searching by keywords. Through stress concurrency test and the daily use of the system, we find that the system can reach a stable and rapid response when multiple users access the system at the same time.