Graduation project - Title: parking lot management system based on big data analysis

Keywords: Java Data Analysis java web

1 Preface

Hi, everyone, this is senior Dan Cheng. Today, I'd like to introduce you to a python web project (currently demo, under development.)

Parking lot management system based on big data analysis (currently demo, under development.)

You can use it for graduation design


2 system effect


3 Preface

The current project is a parking lot management system, which mainly includes data monitoring market, vehicle management, blacklist management, parking management, parking space management, reservation management, log management, user management and role management. Try to complete the functions of the parking lot as much as possible, and then complete the whole front and back-end code with enterprise level development standards. Whether it is used as graduation design or learning, I believe it will be of great help to all students.


4 system architecture


4.1 domain model

  • DO (DataObject): it corresponds to the database table structure one by one and transfers the data source object upward through the DAO layer

  • BO (BusinessObject): business object. An object that encapsulates business logic output by the Service layer

  • VO (View Object): display layer object, usually the object transferred from the Web to the template rendering engine layer

BO and VO domain models are divided into BoRequest (input model), BoResponse (output model), VoRequest (input model) and VoResponse (output model)


4.2 technology stack

Front end: vue + element

Back end: jdk1.8 + springboot + redis + mysql


5 project design

(the project is under development and only some development details are open...)


5.1 interface design

The interfaces of the whole project are designed in restful style, which is popular on the Internet at present. Each interface and parameter are described in detail.

After graduating and entering the enterprise, the development in the enterprise must be team cooperation and the development mode of front-end and back-end separation. You have to define the interface first, and then the front-end and back-end can be developed synchronously.

Another is to provide external interfaces. For example, the team next door also wants to call your service interface, but your two queues are in the same week. At this time, you have to define the interface for others first, and then develop it synchronously. After the development, conduct joint debugging.



5.2 authority design

Permissions are implemented based on security and spring session. Permissions can be divided into authentication and authorization. Authentication is actually login. When a user logs in, the account and password will be verified. After the verification is successful, the session will be stored in redis. Authorization refers to whether a user has permission to access back-end resources. Each new user will be assigned a role after creation. A role is actually a permission set. Permissions here can be understood as permissions to access back-end interfaces (resources).

The permission design here is very flexible, fine-grained to the button level, such as add, delete, modify, query and borrow actions. Ordinary users may only have query permission, while administrators have the permission to add, delete and modify. Even if ordinary users directly access the modified or deleted interface of the back-end through the interface, the back-end will return the authorization failure error, because each interface requiring permission at the back-end is marked with permission ID, and only users with resource permission can access it.

For example, for the following vehicle modification interface, only users with the permission ID of "CAR_UPDATE" can access this interface, otherwise an "unauthorized" error will be returned.

@PutMapping("/{id}")
@PreAuthorize("hasAuthority(T(com.senior.book.console.api.security.Authority).BOOK_UPDATE.name())")
    public Result<Boolean> update(@PathVariable("id") Long id, @Valid @RequestBody BookUpdateVoRequest request) {
        
}


5.3 log scheme

The log adopts the implementation scheme of lombok annotation + slf4j+log4j2. The log configuration of multiple environments is realized based on the profile, because the log printing strategies of different environments are different. For example, in the development environment, I may need to print to the console, debug level logs are required to facilitate local development and debugging, and the test environment may need to print to the log file, The online environment may need to print to the file and send the logs to kafka and then collect them into the ES. In this way, when multiple machines are deployed online, we don't need to check the logs one by one. Because the ES is collected, we only need to log in to kibana to search, which is very convenient. The kafka+es+kibana log solution mentioned here is also a set of solutions commonly used by Internet companies at present. If you have strong hands-on skills, you can build a set of kafka, ES and kibana locally, and then you only need to add a few lines of configuration in the configuration file to realize such an enterprise level log solution (output to the log file by default).

The following are some key configurations. If you want to configure kafka, you only need to configure it in the tag

    <?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN"  xmlns:xi="http://www.w3.org/2001/XInclude">
    <Properties>
        <Property name="LOG_FILE">system.log</Property>
        <Property name="LOG_PATH">./logs</Property>
        <Property name="PID">????</Property>
        <Property name="LOG_EXCEPTION_CONVERSION_WORD">%xwEx</Property>
        <Property name="LOG_LEVEL_PATTERN">%5p</Property>
        <Property name="LOG_DATE_FORMAT_PATTERN">yyyy-MM-dd HH:mm:ss.SSS</Property>
        <Property name="CONSOLE_LOG_PATTERN">%clr{%d{${LOG_DATE_FORMAT_PATTERN}}}{faint} %clr{${LOG_LEVEL_PATTERN}} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}
        </Property>
        <Property name="FILE_LOG_PATTERN">%d{${LOG_DATE_FORMAT_PATTERN}} ${LOG_LEVEL_PATTERN} ${sys:PID} --- [%t] %-40.40c{1.}:%L : %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}
        </Property>
    </Properties>
    <Appenders>
        <xi:include href="log4j2/file-appender.xml"/>
    </Appenders>
    <Loggers>
        <logger name="com.senior.park" level="info"/>
        <Root level="info">
            <AppenderRef ref="FileAppender"/>
        </Root>
    </Loggers>
</Configuration>

5.4 license plate recognition

(key code of license plate recognition Department)

import static org.bytedeco.javacpp.opencv_core.CV_32FC1;
import static com.yxq.carpark.core.CoreFunc.features;

import java.util.HashMap;
import java.util.Map;

import org.bytedeco.javacpp.opencv_core.Mat;
import org.bytedeco.javacpp.opencv_ml.CvANN_MLP;
import com.yxq.carpark.utils.Convert;


public class CharsIdentify {

    public CharsIdentify() {
        loadModel();

        if (this.map.isEmpty()) {
            map.put("zh_cuan", "Chuan");
            map.put("zh_e", "Hubei");
            map.put("zh_gan", "short name for Jiangxi province");
            map.put("zh_gan1", "Sweet");
            map.put("zh_gui", "expensive");
            map.put("zh_gui1", "Cinnamon");
            map.put("zh_hei", "black");
            map.put("zh_hu", "Shanghai");
            map.put("zh_ji", "Hope");
            map.put("zh_jin", "Jin");
            map.put("zh_jing", "Beijing");
            map.put("zh_jl", "luck");
            map.put("zh_liao", "Liao");
            map.put("zh_lu", "Lu");
            map.put("zh_meng", "Meng");
            map.put("zh_min", "Min");
            map.put("zh_ning", "Rather");
            map.put("zh_qing", "young");
            map.put("zh_qiong", "Joan");
            map.put("zh_shan", "Shaanxi");
            map.put("zh_su", "Soviet");
            map.put("zh_sx", "Jin");
            map.put("zh_wan", "Wan");
            map.put("zh_xiang", "Hunan");
            map.put("zh_xin", "new");
            map.put("zh_yu", "Yu");
            map.put("zh_yu1", "Chongqing");
            map.put("zh_yue", "Guangdong");
            map.put("zh_yun", "cloud");
            map.put("zh_zang", "hide");
            map.put("zh_zhe", "Zhejiang");
        }
    }


    /**
     * 
     * @param input
     * @param isChinese
     * @param isSpeci
     * @return result
     */
    public String charsIdentify(final Mat input, final Boolean isChinese, final Boolean isSpeci) {
        String result = "";

        Mat f = features(input, this.predictSize);

        int index = classify(f, isChinese, isSpeci);

        if (!isChinese) {
            result = String.valueOf(strCharacters[index]);
        } else {
            String s = strChinese[index - numCharacter];
            result = map.get(s);
        }
        return result;
    }

    /**
     * 
     * @param f
     * @param isChinses
     * @param isSpeci
     * @return result
     */
    private int classify(final Mat f, final Boolean isChinses, final Boolean isSpeci) {
        int result = -1;
        Mat output = new Mat(1, numAll, CV_32FC1);

        ann.predict(f, output);

        int ann_min = (!isChinses) ? ((isSpeci) ? 10 : 0) : numCharacter;
        int ann_max = (!isChinses) ? numCharacter : numAll;

        float maxVal = -2;

        for (int j = ann_min; j < ann_max; j++) {
            float val = Convert.toFloat(output.ptr(0, j));

            if (val > maxVal) {
                maxVal = val;
                result = j;
            }
        }

        return result;
    }

    private void loadModel() {
        loadModel(this.path);
    }

    public void loadModel(String s) {
        this.ann.clear();
        this.ann.load(s, "ann");
    }

    static boolean hasPrint = false;

    public final void setModelPath(String path) {
        this.path = path;
    }

    public final String getModelPath() {
        return this.path;
    }

    private CvANN_MLP ann = new CvANN_MLP();

    private String path = "res/model/ann.xml";

    private int predictSize = 10;

    private Map<String, String> map = new HashMap<String, String>();

    private final char strCharacters[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
            'F', 'G', 'H', /* No I */'J', 'K', 'L', 'M', 'N', /* No O */'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
            'Z' };
    private final static int numCharacter = 34; // There is no sum of I and 0,10 digits and 24 English characters

    private final String strChinese[] = { "zh_cuan" /* Chuan */, "zh_e" /* Hubei */, "zh_gan" /* short name for Jiangxi province */, "zh_gan1"/* Sweet */,
            "zh_gui"/* expensive */, "zh_gui1"/* Cinnamon */, "zh_hei" /* black */, "zh_hu" /* Shanghai */, "zh_ji" /* Hope */, "zh_jin" /* Jin */,
            "zh_jing" /* Beijing */, "zh_jl" /* luck */, "zh_liao" /* Liao */, "zh_lu" /* Lu */, "zh_meng" /* Meng */,
            "zh_min" /* Min */, "zh_ning" /* Rather */, "zh_qing" /* young */, "zh_qiong" /* Joan */, "zh_shan" /* Shaanxi */,
            "zh_su" /* Soviet */, "zh_sx" /* Jin */, "zh_wan" /* Wan */, "zh_xiang" /* Hunan */, "zh_xin" /* new */, "zh_yu" /* Yu */,
            "zh_yu1" /* Chongqing */, "zh_yue" /* Guangdong */, "zh_yun" /* cloud */, "zh_zang" /* hide */, "zh_zhe" /* Zhejiang */};
    @SuppressWarnings("unused")
    private final static int numChinese = 31;

    private final static int numAll = 65; /* 34+31=65 */
}

6 operation effect


6.1 system login


6.2 data market

The home page data market, according to the proportion of pie chart in the last 7 days, the trend of broken line chart in the last 30 days, the histogram analysis in the last year, and the proportion of each time period in the last 7 days, analyzes all-round visual analysis data.


6.3 vehicle management



6.4 blacklist management

For some vehicles that fail to pay, park according to regulations, and break the contract by making multiple reservations for parking spaces, we can add a blacklist. The vehicles after blacklisting will not be allowed to enter the parking lot.


6.5 parking management

A parking record will be generated after the vehicle is put in storage. At this time, the status is "put in storage" and "unpaid". After the vehicle exits, the system will calculate according to the hourly parking fee of the parking space * the actual parking (calculated by hour, if it exceeds one hour, it will be charged by one hour). Here we need to note that the real parking lot charges are photographed by the camera. For example, when the car leaves the warehouse, the camera will shoot the license plate, and then generate the charging information. After you pay, you can leave the warehouse. Here we are the management background. The system is not connected to the camera equipment, so you need to click the exit button manually. (you can also access the Alipay button interface and camera interface, so that our system is the same as the real parking management system).


6.6 editing user information


6.7 other modules

Slightly (there are many modules, which are not displayed one by one, and are still under development...)


7 finally

Bi design help, problem opening guidance, technical solutions
🇶746876041

Posted by TropicalBeach on Fri, 22 Oct 2021 19:17:02 -0700