• Java进阶(九)日志框架


    九、日志框架

    需要学会什么?

    • 日志框架:系统在开发阶段或者上线后,一旦业务出现问题,需要有信息去定位,如何记录程序的运行信息?
    • 阶段项目:学以致用,使用Java程序处理数据、控制业务逻辑推进。

    1.日志框架

    a.日志技术的概述

    想清楚的知道一个系统运行的过程和详情怎么办?

    • 生活中的日志:生活中的日志就好比日记,可以记录生活的点点滴滴。
    • 程序中的日志:程序中的日志可以用来记录程序运行过程中的信息,并可以进行永久存储。

    输出语句记录日志的弊端:

    • 信息只能展示在控制台。
    • 不能将其记录到其他的位置(文件,数据库)。
    • 想取消记录的信息需要修改代码才可以完成。

    以前记录日志的方式:

        Scanner scanner = new Scanner(System.in)
        System.out.println("请输入一个整数");
        String number = scanner.nextLine();
    
        try {
            int result = Integer.parseInt(number);
            System.out.println("输入的数字为:" result);
        } catch (NumberFormatException e) {
            System.out.println("输入的数字有误,请输入一个整数!");
        }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    日志技术具备的优势:

    • 可以将系统执行的信息选择性的记录到指定的位置(控制台、文件、数据库)。
    • 可以随时以开发的形式控制是否记录日志,无需修改源代码。
    输出语句日志技术
    输出位置只能是控制台。可以将日志信息写入到文件或者数据库中。
    取消日志需求修改代码,灵活性比较差。不需要修改代码,灵活性比较好。
    多线程性能较差。性能较好。

    b.日志技术体系结构

    日志规范:一些接口,提供给日志的实现框架设计的标准。

    • Commons Logging(JCL)
    • Simple Logging Facade for Java(slf4j)

    因为对Commons Logging的接口不满意,有人做了SLF4J。

    日志框架:牛人或者第三方公司已经做好的日志记录实现代码,后来者可以直接拿去使用。

    • Log4j
    • JUL(java.util.logging)
    • Logback
    • 其他实现

    因为对Log4j的性能不满意,有人做了Logback。

    c.Logback概述

    Logback日志框架:

    • Logback是由Log4j创始人设计的另一个开源日志组件,性能比Log4j更好。
    • 官方网站:https://logback.qos.ch/
    • Logback是基于slf4j的日志规范实现的框架。

    Logback主要分为三个技术模块:

    • logback-core:logback-core模块为其他模块奠定了基础,必须有。
    • logback-calssic:它是Log4j的一个改良版本,同时它完整实现了slf4j API。
    • logback-access模块与Tomcat和Jetty等Servlet容器集成,以提供HTTP访问日志功能。

    总结:

    1. 使用Logback需要使用哪几个模块,各自的作用是什么?
      • slf4j-api:日志规范。
      • logback-core:基础模块。
      • logback-classic:它是log4j的一个改良版本,同时它完整实现了slf4j API。

    d.Logback快速入门

    需求:

    • 导入Logback日志技术到项目中,用于记录系统的日志信息。

    分析:

    1. 在项目下新建文件夹lib,导入Logback的相关jar包到该文件夹下,并添加到项目依赖库中去。(选中jar包文件,右键Add as Library。)

      • logback-classic-1.2.9.jar
      • logback-core-1.2.9.jar
      • slf4j-api-1.7.9.jar
    2. 将Logback的核心配置文件logback.xml直接拷贝到src目录下。(如果没有,则使用默认配置。)

      
      
      • 1
    3. 在代码中获取日志对象。

      public static final Logger LOGGER = LoggerFactory.getLogger("类对象");
      
      • 1

    Test.java

    package com.javase.logbackdemo;
    
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    public class Test {
        // 创建Logback日志对象
        public static final Logger LOGGER = LoggerFactory.getLogger("Test.class");
    
        public static void main(String[] args) {
            try {
                LOGGER.debug("main方法开始执行力...");
                LOGGER.info("开始记录第二行日志 开始做除法");
    
                int a = 10;
                int b = 0;
                LOGGER.trace("a=" + a);
                LOGGER.trace("b=" + b);
    
                System.out.println(a / b);
            } catch (Exception e) {
                e.printStackTrace();
                LOGGER.error("功能出现异常:" + e);
            }
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27

    e.Logback配置详解-输出位置、格式设置

    Logback日志系统的特性都是通过核心配置文件logback.xml控制的。

    Logback日志输出位置、格式设置:

    • 通过logback.xml中的标签可以设置输出位置和日志信息的详细格式。
    • 通常可以设置2个日志输出位置:一个是控制台、一个是系统文件中。

    输出到控制台的配置标志:

    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    
    • 1

    输出到系统文件的配置标志:

    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    
    • 1

    f.Logback配置详解-日志级别设置

    如果系统上线后只想记录一些错误的日志信息或者不想记录日志了,怎么办?

    • 可以设置日志的输出级别来控制哪些日志信息输出或者不输出。

    日志级别:

    • 级别程度依次是:TRACE < DEBUG < INFO < WARN < ERROR;默认级别是DEBUG,对应其方法。
    • 作用:用于控制系统中哪些日志级别是可以输出的,只输出级别不低于设定级别的日志信息。
    • ALL和OFF分别是打开全部日志信息,及关闭全部日志信息。

    具体在标签的level属性中设置日志级别。

    <root level="INFO">
        <appender-ref ref="CONSOLEL" />
        <appender-ref ref="FILE" />
    root>
    
    • 1
    • 2
    • 3
    • 4

    2.阶段项目实战

    a.电影投票系统简介、项目功能演示

    电影购票系统技术选型分析:

    • 面向对象编程:系统包含了电影对象、商家对象、客户对象、需要用到继承、多态等语法知识。
    • 使用集合容器:系统需要提供不同的容器分别存储系统注册的用户,以及当前商家发布的电影信息。
    • 程序流程控制:需要结合分支、循环、跳转关键字等相关操作控制程序的业务逻辑。
    • 使用常见API:登录信息的内容比较,业务数据的分析、处理、日期时间的处理等。

    学习完成本项目,将得到以下收获:

    • 优秀的面向对象编程能力。
    • 清晰、缜密的业务、数据分析能力。
    • 熟练使用程序流程技术来控制计算机完成自己的想法。
    • 形成良好的编码习惯,获得一定的编码经验。提升业务分析和解决问题的能力,让基础知识形成体系结构,为后续WEB技术的学习做有力的支撑。

    b.日志框架搭建、系统角色分析

    系统角色类准备:

    • 集成日志框架、用于后期记录日志信息。
    • 定义一个电影类Movie类,Movie类包含:片名、主演、评分、时长、票价、余票。
    • 系统包含2个用户角色:客户、商家。存在大量相同属性信息。
    • 定义User类作为父类,属性:登录名称、密码、真实名称、性别、电话、账号余额。
    • 定义Business类代表商家角色,属性:店铺名称、地址。
    • 定义Customer类代表客户角色。
    • 定义集合List用户存放系统注册的用户对象信息。
    • 定义集合Map存放商家和其排片信息。
    • 添加测试数据。

    Movie.java

    import java.util.Date;
    
    /**
     * 电影类
     */
    public class Movie {
        // 片名
        private String name;
        // 主演
        private String actor;
        // 评分
        private double score;
        // 票价
        private double price;
        // 电影时长
        private double time;
        // 余票数
        private int number;
        // 放映时间
        private Date startTime;
    
        public Movie() {
    
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public String getActor() {
            return actor;
        }
    
        public void setActor(String actor) {
            this.actor = actor;
        }
    
        public double getScore() {
            return score;
        }
    
        public void setScore(double score) {
            this.score = score;
        }
    
        public double getPrice() {
            return price;
        }
    
        public void setPrice(double price) {
            this.price = price;
        }
    
        public double getTime() {
            return time;
        }
    
        public void setTime(double time) {
            this.time = time;
        }
    
        public int getNumber() {
            return number;
        }
    
        public void setNumber(int number) {
            this.number = number;
        }
    
        public Date getStartTime() {
            return startTime;
        }
    
        public void setStartTime(Date startTime) {
            this.startTime = startTime;
        }
    
        public Movie(String name, String actor, double price, double time, int number, Date startTime) {
            this.name = name;
            this.actor = actor;
            this.price = price;
            this.time = time;
            this.number = number;
            this.startTime = startTime;
        }
    
        @Override
        public String toString() {
            return "Movie{" +
                    "name='" + name + '\'' +
                    ", actor='" + actor + '\'' +
                    ", score=" + score +
                    ", price=" + price +
                    ", time=" + time +
                    ", number=" + number +
                    ", startTime=" + startTime +
                    '}';
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104

    User.java

    /**
     * 用户类:客户和商家的父类
     */
    public class User {
        // 假名 不可重复
        private String loginName;
        // 真名
        private String userName;
        // 密码
        private String password;
        // 性别
        private char sex;
        // 电话号码
        private String phone;
        // 余额
        private double money;
    
        public User() {
        }
    
        public User(String loginName, String userName, String password, char sex, String phone, double money) {
            this.loginName = loginName;
            this.userName = userName;
            this.password = password;
            this.sex = sex;
            this.phone = phone;
            this.money = money;
        }
    
        public String getLoginName() {
            return loginName;
        }
    
        public void setLoginName(String loginName) {
            this.loginName = loginName;
        }
    
        public String getUserName() {
            return userName;
        }
    
        public void setUserName(String userName) {
            this.userName = userName;
        }
    
        public String getPassword() {
            return password;
        }
    
        public void setPassword(String password) {
            this.password = password;
        }
    
        public char getSex() {
            return sex;
        }
    
        public void setSex(char sex) {
            this.sex = sex;
        }
    
        public String getPhone() {
            return phone;
        }
    
        public void setPhone(String phone) {
            this.phone = phone;
        }
    
        public double getMoney() {
            return money;
        }
    
        public void setMoney(double money) {
            this.money = money;
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78

    Business.java

    /**
     * 商家类
     */
    public class Business extends User {
        // 店铺名称
        private String shopName;
        // 店铺地址
        private String address;
    
        public String getShopName() {
            return shopName;
        }
    
        public void setShopName(String shopName) {
            this.shopName = shopName;
        }
    
        public String getAddress() {
            return address;
        }
    
        public void setAddress(String address) {
            this.address = address;
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    Customer.java

    /**
     * 客户类
     */
    public class Customer extends User {
    
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    MovieSystem.java

    import com.javase.bean.Business;
    import com.javase.bean.Customer;
    import com.javase.bean.Movie;
    import com.javase.bean.User;
    
    import java.util.*;
    
    /**
     * 电影系统类
     */
    public class MovieSystem {
    
        // 定义系统的数据容器用于存储数据
        // 存储很多客户对象 商家对象
        public static final List<User> ALL_USERS = new ArrayList<>();
    
        // 存储系统全部商家和其排片信息
        public static final Map<Business, List<Movie>> ALL_MOVIES = new HashMap<>();
    
        /*        employeeList2.add(new Employee("张无忌", '男', 30000, 2000000, "错放陈友谅"));
            employeeList2.add(new Employee("赵敏", '女', 10000, 20000, null));
            employeeList2.add(new Employee("周芷若", '女', 10000, 2000, "反复无常"));
            employeeList2.add(new Employee("小昭", '女', 10000, 20000, null));
            employeeList2.add(new Employee("殷离", '女', 10000, 10000, null));
            employeeList2.add(new Employee("张翠山", '男', 10000, 500, "冲动易怒惹人厌"));*/
    
        // 测试数据
        static {
            /* 添加客户对象*/
            Customer customer1 = new Customer();
            customer1.setLoginName("ZWJ");
            customer1.setUserName("张无忌");
            customer1.setPassword("123456");
            customer1.setSex('男');
            customer1.setPhone("18888888881");
            customer1.setMoney(10000);
            ALL_USERS.add(customer1);
    
            Customer customer2 = new Customer();
            customer2.setLoginName("ZM");
            customer2.setUserName("赵敏");
            customer2.setPassword("123456");
            customer2.setSex('女');
            customer2.setPhone("18888888882");
            customer2.setMoney(8000);
            ALL_USERS.add(customer2);
    
            Customer customer3 = new Customer();
            customer3.setLoginName("ZZR");
            customer3.setUserName("周芷若");
            customer3.setPassword("123456");
            customer3.setSex('女');
            customer3.setPhone("18888888883");
            customer3.setMoney(1000);
            ALL_USERS.add(customer3);
    
            /* 添加商家对象 */
            Business business1 = new Business();
            business1.setLoginName("BZH");
            business1.setUserName("白子画");
            business1.setPassword("123456");
            business1.setSex('男');
            business1.setPhone("19888888881");
            business1.setMoney(9000000);
            business1.setShopName("长留山国际影城");
            ALL_USERS.add(business1);
            List<Movie> movieList1 = new ArrayList<>();
            ALL_MOVIES.put(business1, movieList1);
    
            Business business2 = new Business();
            business2.setLoginName("DFYQ");
            business2.setUserName("东方彧卿");
            business2.setPassword("123456");
            business2.setSex('男');
            business2.setPhone("19888888882");
            business2.setMoney(1000000);
            business2.setShopName("异朽阁国际影院");
            ALL_USERS.add(business2);
            List<Movie> movieList2 = new ArrayList<>();
            ALL_MOVIES.put(business2, movieList2);
        }
    
        public static void main(String[] args) {
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86

    c.首页设计、登录、商家界面、用户界面实现

    首页、登录、商家界面、用户界面设计:

    • 首先需要包含登录、商家入驻、客户注册功能。
    • 商家和客户可以共用一个登录功能。
    • 判断登录成功的用户的真实类型,判断用户类型完成对应的操作界面设计。

    d.商家-详情页设计、影片上架、退出

    商家功能-展示详情、影片上架、退出:

    • 展示本商家的信息和其排片情况。
    • 提供影片上架功能:就是创建一个影片对象,存入到商家的集合中去。
    • 退出,需要回到登录的首页。

    e.商家-影片下架、影片修改

    商家功能-影片下架、影片修改:

    • 提供影片下架功能:其实就是从商家的集合中删除影片对象。
    • 影片修改功能:拿到需要修改的影片对象,修改里面的数据。

    f.用户-展示全部影片

    用户功能-展示全部影片信息:

    • 其实就是遍历全部商家和其排片信息并展示出来。

    g.用户-购票功能

    • 用户可以选择需要购买票的商家和其电影信息。
    • 可以选择购买的数量。
    • 购买成功后需要支付金额,并更新商家金额和客户金额。

    Movie.java

    package com.javase.bean;
    
    import java.util.Date;
    
    /**
     * 电影类
     */
    public class Movie {
        // 片名
        private String name;
        // 主演
        private String actor;
        // 评分
        private double score;
        // 票价
        private double price;
        // 电影时长
        private double time;
        // 余票数
        private int number;
        // 放映时间
        private Date startTime;
    
        public Movie() {
    
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public String getActor() {
            return actor;
        }
    
        public void setActor(String actor) {
            this.actor = actor;
        }
    
        public double getScore() {
            return score;
        }
    
        public void setScore(double score) {
            this.score = score;
        }
    
        public double getPrice() {
            return price;
        }
    
        public void setPrice(double price) {
            this.price = price;
        }
    
        public double getTime() {
            return time;
        }
    
        public void setTime(double time) {
            this.time = time;
        }
    
        public int getNumber() {
            return number;
        }
    
        public void setNumber(int number) {
            this.number = number;
        }
    
        public Date getStartTime() {
            return startTime;
        }
    
        public void setStartTime(Date startTime) {
            this.startTime = startTime;
        }
    
        public Movie(String name, String actor, double price, double time, int number, Date startTime) {
            this.name = name;
            this.actor = actor;
            this.price = price;
            // 评分由观众打分
            // this.score = score;
            this.time = time;
            this.number = number;
            this.startTime = startTime;
        }
    
        @Override
        public String toString() {
            return "Movie{" +
                    "name='" + name + '\'' +
                    ", actor='" + actor + '\'' +
                    ", score=" + score +
                    ", price=" + price +
                    ", time=" + time +
                    ", number=" + number +
                    ", startTime=" + startTime +
                    '}';
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108

    User.java

    package com.javase.bean;
    
    /**
     * 用户类:客户和商家的父类
     */
    public class User {
        // 假名 不可重复
        private String loginName;
        // 真名
        private String userName;
        // 密码
        private String password;
        // 性别
        private char sex;
        // 电话号码
        private String phone;
        // 余额
        private double money;
    
        public User() {
        }
    
        public User(String loginName, String userName, String password, char sex, String phone, double money) {
            this.loginName = loginName;
            this.userName = userName;
            this.password = password;
            this.sex = sex;
            this.phone = phone;
            this.money = money;
        }
    
        public String getLoginName() {
            return loginName;
        }
    
        public void setLoginName(String loginName) {
            this.loginName = loginName;
        }
    
        public String getUserName() {
            return userName;
        }
    
        public void setUserName(String userName) {
            this.userName = userName;
        }
    
        public String getPassword() {
            return password;
        }
    
        public void setPassword(String password) {
            this.password = password;
        }
    
        public char getSex() {
            return sex;
        }
    
        public void setSex(char sex) {
            this.sex = sex;
        }
    
        public String getPhone() {
            return phone;
        }
    
        public void setPhone(String phone) {
            this.phone = phone;
        }
    
        public double getMoney() {
            return money;
        }
    
        public void setMoney(double money) {
            this.money = money;
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80

    Business.java

    package com.javase.bean;
    
    /**
     * 商家类
     */
    public class Business extends User {
        // 店铺名称
        private String shopName;
        // 店铺地址
        private String address;
    
        public String getShopName() {
            return shopName;
        }
    
        public void setShopName(String shopName) {
            this.shopName = shopName;
        }
    
        public String getAddress() {
            return address;
        }
    
        public void setAddress(String address) {
            this.address = address;
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    Customer.java

    package com.javase.bean;
    
    /**
     * 客户类
     */
    public class Customer extends User {
    
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    MovieSystem.java

    package com.javase.run;
    
    import com.javase.bean.Business;
    import com.javase.bean.Customer;
    import com.javase.bean.Movie;
    import com.javase.bean.User;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    import java.math.BigDecimal;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.*;
    
    /**
     * 电影系统类
     */
    public class MovieSystem {
    
        // 创建日志对象
        public static final Logger LOGGER = LoggerFactory.getLogger("MovieSystem.calss");
    
        // 存储很多客户对象 商家对象
        public static final List<User> ALL_USERS = new ArrayList<>();
    
        // 存储系统全部商家和其排片信息
        public static final Map<Business, List<Movie>> ALL_MOVIES = new HashMap<>();
    
        // 扫描器
        public static final Scanner SCANNER = new Scanner(System.in);
    
        // 登录成功用户
        public static User loginUser;
    
        // 简单日期格式化对象
        public static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    
        // 测试数据
        static {
            /* 添加客户对象*/
            Customer customer1 = new Customer();
            customer1.setLoginName("ZWJ");
            customer1.setUserName("张无忌");
            customer1.setPassword("123456");
            customer1.setSex('男');
            customer1.setPhone("18888888881");
            customer1.setMoney(10000);
            ALL_USERS.add(customer1);
    
            Customer customer2 = new Customer();
            customer2.setLoginName("ZM");
            customer2.setUserName("赵敏");
            customer2.setPassword("123456");
            customer2.setSex('女');
            customer2.setPhone("18888888882");
            customer2.setMoney(8000);
            ALL_USERS.add(customer2);
    
            Customer customer3 = new Customer();
            customer3.setLoginName("ZZR");
            customer3.setUserName("周芷若");
            customer3.setPassword("123456");
            customer3.setSex('女');
            customer3.setPhone("18888888883");
            customer3.setMoney(1000);
            ALL_USERS.add(customer3);
    
            /* 添加商家对象 */
            Business business1 = new Business();
            business1.setLoginName("BZH");
            business1.setUserName("白子画");
            business1.setPassword("123456");
            business1.setSex('男');
            business1.setPhone("19888888881");
            business1.setMoney(9000000);
            business1.setShopName("长留山国际影城");
            business1.setAddress("长留山");
            ALL_USERS.add(business1);
            List<Movie> movieList1 = new ArrayList<>();
            ALL_MOVIES.put(business1, movieList1);
    
            Business business2 = new Business();
            business2.setLoginName("DFYQ");
            business2.setUserName("东方彧卿");
            business2.setPassword("123456");
            business2.setSex('男');
            business2.setPhone("19888888882");
            business2.setMoney(1000000);
            business2.setShopName("异朽阁国际影院");
            business2.setAddress("异朽阁");
            ALL_USERS.add(business2);
            List<Movie> movieList2 = new ArrayList<>();
            ALL_MOVIES.put(business2, movieList2);
        }
    
        /**
         * 主函数
         *
         * @param args
         */
        public static void main(String[] args) {
            // 首页
            showMain();
        }
    
        /**
         * 首页
         */
        private static void showMain() {
    
            while (true) {
                System.out.println("==============首页==============");
                System.out.println("1.登录");
                System.out.println("2.用户注册");
                System.out.println("3.商家注册");
                System.out.println("请输入操作命令:");
    
                // 接收控制台输入
                String command = SCANNER.nextLine();
    
                switch (command) {
                    case "1":
                        // 登录
                        login();
                        break;
                    case "2":
                        // 用户注册
                        break;
                    case "3":
                        // 商家注册
                        break;
                    default:
                        System.out.println("输入命令有误,请确认!");
                }
            }
        }
    
        /**
         * 登录功能
         */
        private static void login() {
            while (true) {
                System.out.println("请您输入登录名称:");
                String loginName = SCANNER.nextLine();
                System.out.println("请您输入登录密码:");
                String password = SCANNER.nextLine();
    
                // 根据登录名称查询用户对象
                User user = getUserByLoginName(loginName);
    
                // 判断用户是否存在
                if (user != null) {
    
                    // 对比密码是否正确
                    if (user.getPassword().equals(password)) {
                        // 记录登录成功用户
                        loginUser = user;
                        LOGGER.info(user.getUserName() + "登录了系统.");
    
                        if (user instanceof Customer) {
                            // 普通用户登录成功
                            showCustomerMain();
                        } else {
                            // 商家用户登录成功
                            showBusinessMain();
                        }
                        break;
                    } else {
                        System.out.println("密码错误!");
                    }
    
                } else {
                    System.out.println("登录名称错误,请重新输入!");
                }
            }
        }
    
        /**
         * 商家操作界面
         */
        private static void showBusinessMain() {
            while (true) {
                System.out.println("==============商家操作界面==============");
                System.out.println("欢迎" + loginUser.getUserName() + (loginUser.getSex() == '男' ? "先生" : "女士") + "进入系统");
                System.out.println("请您选择要操作的功能");
                System.out.println("1.展示商家详情");
                System.out.println("2.上架电影");
                System.out.println("3.下架电影");
                System.out.println("4.修改电影");
                System.out.println("5.退出");
    
                System.out.println("请输入您要操作的命令");
                String command = SCANNER.nextLine();
                switch (command) {
                    case "1":
                        // 展示商家详情
                        showBusinessInfo();
                        break;
                    case "2":
                        // 上架电影
                        addMoive();
                        break;
                    case "3":
                        // 下架电影
                        deleteMoive();
                        break;
                    case "4":
                        // 修改电影
                        updateMoive();
                        break;
                    case "5":
                        // 退出
                        System.out.println("欢迎下次使用系统!");
                        return;
                    default:
                        System.out.println("命令输入错误!");
                        break;
                }
            }
        }
    
        /**
         * 修改电影
         */
        private static void updateMoive() {
            // 用户对象转为商家对象
            Business business = (Business) loginUser;
    
            List<Movie> movieList = ALL_MOVIES.get(business);
    
            System.out.println("==============商家修改电影界面==============");
            if (movieList.size() == 0) {
                System.out.println("当前无电影可修改!");
                return;
            }
    
            while (true) {
                System.out.println("请您输入需要修改的电影名称:");
                String movieName = SCANNER.nextLine();
    
                // 根据电影名称查找当前商家的电影对象
                Movie movie = getMovieByName(movieName);
    
                if (movie != null) {
                    System.out.println("请您修改后的输入新片名:");
                    String name = SCANNER.nextLine();
                    System.out.println("请您修改后的输入主演:");
                    String actor = SCANNER.nextLine();
                    System.out.println("请您修改后的输入时长:");
                    String time = SCANNER.nextLine();
                    System.out.println("请您修改后的输入票价:");
                    String price = SCANNER.nextLine();
                    System.out.println("请您修改后的输入票数:");
                    String number = SCANNER.nextLine();
    
                    while (true) {
                        try {
                            System.out.println("请您修改后的影片的放映时间:");
                            String startTime = SCANNER.nextLine();
    
                            movie.setName(name);
                            movie.setActor(actor);
                            movie.setPrice(Double.valueOf(price));
                            movie.setTime(Double.valueOf(time));
                            movie.setNumber(Integer.valueOf(number));
                            movie.setStartTime(simpleDateFormat.parse(startTime));
                            System.out.println("您已经修改电影:《" + movie.getName() + "》");
    
                            showBusinessInfo();
                            return;
    
                        } catch (ParseException e) {
                            e.printStackTrace();
                            LOGGER.error("时间解析存在问题!");
                        }
                    }
    
                } else {
                    System.out.println("您的店铺没有上架该影片!");
                    System.out.println("是否继续修改影片:y/n");
                    String command = SCANNER.nextLine();
    
                    if (!command.equals("Y")) {
                        System.out.println("好的!");
                        return;
                    }
                }
            }
        }
    
        /**
         * 下架电影
         */
        private static void deleteMoive() {
    
            // 用户对象转为商家对象
            Business business = (Business) loginUser;
    
            List<Movie> movieList = ALL_MOVIES.get(business);
    
    
            System.out.println("==============商家下架电影界面==============");
            if (movieList.size() == 0) {
                System.out.println("当前无电影可下架!");
                return;
            }
    
            while (true) {
                System.out.println("请您输入需要下架的电影名称:");
                String movieName = SCANNER.nextLine();
    
                // 根据电影名称查找当前商家的电影对象
                Movie movie = getMovieByName(movieName);
    
                if (movie != null) {
                    movieList.remove(movie);
                    System.out.println("您的店铺已成功下架:" + movie.getName());
                    return;
                } else {
                    System.out.println("您的店铺没有上架该影片!");
                    System.out.println("是否继续下架影片:y/n");
                    String command = SCANNER.nextLine();
    
                    if (!command.equals("Y")) {
                        System.out.println("好的!");
                        return;
                    }
                }
            }
        }
    
        /**
         * 根据电影名称查找当前商家的电影对象
         *
         * @param movieName 电影名称
         * @return 电影对象
         */
        private static Movie getMovieByName(String movieName) {
            // 用户对象转为商家对象
            Business business = (Business) loginUser;
    
            List<Movie> movieList = ALL_MOVIES.get(business);
    
            for (Movie movie : movieList) {
                // 模糊查询
                if (movie.getName().contains(movieName)) {
                    return movie;
                }
            }
    
            return null;
        }
    
        /**
         * 上架电影
         */
        private static void addMoive() {
    
            // 用户对象转为商家对象
            Business business = (Business) loginUser;
    
            List<Movie> movieList = ALL_MOVIES.get(business);
    
            System.out.println("==============商家上架电影界面==============");
            System.out.println("请您输入新片名:");
            String name = SCANNER.nextLine();
            System.out.println("请您输入主演:");
            String actor = SCANNER.nextLine();
            System.out.println("请您输入时长:");
            String time = SCANNER.nextLine();
            System.out.println("请您输入票价:");
            String price = SCANNER.nextLine();
            System.out.println("请您输入票数:");
            String number = SCANNER.nextLine();
    
            while (true) {
                try {
                    System.out.println("请您输入影片的放映时间:");
                    String startTime = SCANNER.nextLine();
    
                    Movie movie = new Movie(name, actor, Double.valueOf(price), Double.valueOf(time), Integer.valueOf(number), simpleDateFormat.parse(startTime));
    
                    movieList.add(movie);
                    System.out.println("您已经成功上架了:《" + movie.getName() + "》");
    
                    return;
                } catch (ParseException e) {
                    e.printStackTrace();
                    LOGGER.error("时间解析存在问题!");
                }
            }
    
        }
    
        /**
         * 展示商家详情
         */
        private static void showBusinessInfo() {
    
            System.out.println("==============商家详情界面==============");
            LOGGER.info(loginUser.getUserName() + "商家正在查看店铺的详情信息.");
    
            // 用户对象转为商家对象
            Business business = (Business) loginUser;
    
            System.out.println(business.getShopName() + "\t\t" + business.getPhone() + "\t\t" + business.getAddress());
    
            System.out.println();
            // 根据商家对象作为Map集合的键提取对应集合的值
            List<Movie> movieList = ALL_MOVIES.get(loginUser);
    
            // 如果电影集合为空
            if (movieList.size() > 0) {
                System.out.println("片名\t\t\t主演\t\t评分\t\t票价\t\t电影时长\t\t余票数\t\t放映时间");
                for (Movie movie : movieList) {
                    System.out.println(movie.getName() + "\t\t\t" + movie.getActor() + "\t\t" + movie.getScore()
                            + "\t\t" + movie.getPrice() + "\t\t" + movie.getTime() + "\t\t" + movie.getNumber()
                            + "\t\t" + simpleDateFormat.format(movie.getStartTime()));
                }
            } else {
                System.out.println("当前您的店铺无片在放映...");
            }
        }
    
        /**
         * 客户操作界面
         */
        private static void showCustomerMain() {
            while (true) {
                System.out.println("==============客户操作界面==============");
                System.out.println("欢迎" + loginUser.getUserName() + (loginUser.getSex() == '男' ? "先生" : "女士") + "进入系统!" + "\t余额:" + loginUser.getMoney());
                System.out.println("请您选择要操作的功能");
                System.out.println("1.展示全部影片信息功能");
                System.out.println("2.根据电影名称查询电影信息");
                System.out.println("3.评分功能");
                System.out.println("4.购票功能");
                System.out.println("5.退出系统");
    
                System.out.println("请输入您要操作的命令");
                String command = SCANNER.nextLine();
                switch (command) {
                    case "1":
                        // 展示全部影片信息功能
                        showAllMovies();
                        break;
                    case "2":
                        // 根据电影名称查询电影信息
                        break;
                    case "3":
                        // 评分功能
                        break;
                    case "4":
                        // 购票功能
                        buyMovieTickets();
                        break;
                    case "5":
                        // 退出系统
                        System.out.println("欢迎下次使用系统!");
                        return;
                    default:
                        System.out.println("命令输入错误!");
                        break;
                }
            }
        }
    
        /**
         * 客户购票功能
         */
        private static void buyMovieTickets() {
            // 展示全部影片信息
            showAllMovies();
    
            System.out.println("==============客户购票界面==============");
    
            while (true) {
                System.out.println("请您输入需要买票的影院:");
                String shopName = SCANNER.nextLine();
    
                // 根据影院查询商家对象
                Business business = getBusinessByShopName(shopName);
    
                if (business == null) {
                    System.out.println("该影院不存在!");
                } else {
                    // 该影院所有的电影
                    List<Movie> movieList = ALL_MOVIES.get(business);
    
                    // 判断该影院影片是否为空
                    if (movieList.size() > 0) {
                        System.out.println("请输入需要购买电影名称:");
                        String movieName = SCANNER.nextLine();
    
                        // 根据电影名称查询电影对象
                        Movie movie = getMovieByShopAndName(business, movieName);
    
                        if (movie != null) {
                            // 购票
                            System.out.println("请您输入购买电影票数:");
                            String number = SCANNER.nextLine();
                            int buyNumber = Integer.valueOf(number);
    
                            // 判断是否购票
                            if (movie.getNumber() >= buyNumber) {
                                // 购票金额
                                double money = BigDecimal.valueOf(movie.getPrice()).multiply(BigDecimal.valueOf(buyNumber)).doubleValue();
    
                                if (loginUser.getMoney() >= money) {
                                    // 买票
                                    System.out.println("您成功购买了" + movie.getName() + buyNumber + "张票,总金额是:" + money);
    
                                    // 更新本人金额
                                    loginUser.setMoney(loginUser.getMoney() - money);
                                    // 更新商家金额
                                    business.setMoney(business.getMoney() + money);
    
                                    // 更新票
                                    movie.setNumber(movie.getNumber() - buyNumber);
                                    return;
    
                                } else {
                                    // 票数不够
                                    System.out.println("是否继续买票:y/n");
                                    String command = SCANNER.nextLine();
    
                                    if (!command.equals("y")) {
                                        System.out.println("好的!");
                                        return;
                                    }
                                }
                            } else {
                                System.out.println("您当前最多可以购买:" + movie.getNumber());
    
                                System.out.println("是否继续买票:y/n");
                                String command = SCANNER.nextLine();
    
                                if (!command.equals("y")) {
                                    System.out.println("好的!");
                                    return;
                                }
                            }
                        } else {
                            System.out.println("影片不存在!");
                        }
    
                    } else {
                        System.out.println("抱歉,该影院已经打烊了!");
                        System.out.println("是否继续买票:y/n");
                        String command = SCANNER.nextLine();
    
                        if (!command.equals("y")) {
                            System.out.println("好的!");
                            return;
                        }
                    }
                }
            }
    
        }
    
        /**
         * 根据电影名称查询电影对象
         *
         * @param business 商家对象
         * @param movieName 电影名称
         * @return 电影对象
         */
        public static Movie getMovieByShopAndName(Business business, String movieName) {
            List<Movie> movieList = ALL_MOVIES.get(business);
    
            for (Movie movie : movieList) {
                if (movie.getName().contains(movieName)) {
                    return movie;
                }
            }
    
            return null;
        }
    
        /**
         * 根据影院查询商家对象
         *
         * @return 商家对象
         */
        public static Business getBusinessByShopName(String shopName) {
            // 获取所有商家对象
            Set<Business> businesses = ALL_MOVIES.keySet();
    
            for (Business business : businesses) {
                if (business.getShopName().equals(shopName)) {
                    return business;
                }
            }
    
            return null;
    
        }
    
        /**
         * 展示全部影片信息
         */
        private static void showAllMovies() {
    
            System.out.println("==============客户展示全部影片信息界面==============");
    
            ALL_MOVIES.forEach((business, movieList) -> {
                // 商家信息
                System.out.println(business.getShopName() + "\t\t" + business.getPhone() + "\t\t" + business.getAddress());
    
                System.out.println("片名\t\t\t主演\t\t评分\t\t票价\t\t电影时长\t\t余票数\t\t放映时间");
                for (Movie movie : movieList) {
                    System.out.println(movie.getName() + "\t\t\t" + movie.getActor() + "\t\t" + movie.getScore()
                            + "\t\t" + movie.getPrice() + "\t\t" + movie.getTime() + "\t\t" + movie.getNumber()
                            + "\t\t" + simpleDateFormat.format(movie.getStartTime()));
                }
            });
        }
    
        /**
         * 根据登录名查找用户
         *
         * @param loginName 登录名
         * @return 用户
         */
        public static User getUserByLoginName(String loginName) {
            // 遍历所有用户
            for (User user : ALL_USERS) {
                // 判断用户是否存在
                if (user.getLoginName().equals(loginName)) {
                    return user;
                }
            }
    
            return null;
        }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409
    • 410
    • 411
    • 412
    • 413
    • 414
    • 415
    • 416
    • 417
    • 418
    • 419
    • 420
    • 421
    • 422
    • 423
    • 424
    • 425
    • 426
    • 427
    • 428
    • 429
    • 430
    • 431
    • 432
    • 433
    • 434
    • 435
    • 436
    • 437
    • 438
    • 439
    • 440
    • 441
    • 442
    • 443
    • 444
    • 445
    • 446
    • 447
    • 448
    • 449
    • 450
    • 451
    • 452
    • 453
    • 454
    • 455
    • 456
    • 457
    • 458
    • 459
    • 460
    • 461
    • 462
    • 463
    • 464
    • 465
    • 466
    • 467
    • 468
    • 469
    • 470
    • 471
    • 472
    • 473
    • 474
    • 475
    • 476
    • 477
    • 478
    • 479
    • 480
    • 481
    • 482
    • 483
    • 484
    • 485
    • 486
    • 487
    • 488
    • 489
    • 490
    • 491
    • 492
    • 493
    • 494
    • 495
    • 496
    • 497
    • 498
    • 499
    • 500
    • 501
    • 502
    • 503
    • 504
    • 505
    • 506
    • 507
    • 508
    • 509
    • 510
    • 511
    • 512
    • 513
    • 514
    • 515
    • 516
    • 517
    • 518
    • 519
    • 520
    • 521
    • 522
    • 523
    • 524
    • 525
    • 526
    • 527
    • 528
    • 529
    • 530
    • 531
    • 532
    • 533
    • 534
    • 535
    • 536
    • 537
    • 538
    • 539
    • 540
    • 541
    • 542
    • 543
    • 544
    • 545
    • 546
    • 547
    • 548
    • 549
    • 550
    • 551
    • 552
    • 553
    • 554
    • 555
    • 556
    • 557
    • 558
    • 559
    • 560
    • 561
    • 562
    • 563
    • 564
    • 565
    • 566
    • 567
    • 568
    • 569
    • 570
    • 571
    • 572
    • 573
    • 574
    • 575
    • 576
    • 577
    • 578
    • 579
    • 580
    • 581
    • 582
    • 583
    • 584
    • 585
    • 586
    • 587
    • 588
    • 589
    • 590
    • 591
    • 592
    • 593
    • 594
    • 595
    • 596
    • 597
    • 598
    • 599
    • 600
    • 601
    • 602
    • 603
    • 604
    • 605
    • 606
    • 607
    • 608
    • 609
    • 610
    • 611
    • 612
    • 613
    • 614
    • 615
    • 616
    • 617
    • 618
    • 619
    • 620
    • 621
    • 622
    • 623
    • 624
    • 625
    • 626
    • 627
    • 628
    • 629
    • 630
    • 631
    • 632
    • 633
    • 634
    • 635
    • 636
    • 637
  • 相关阅读:
    LeetCode刷题---19. 删除链表的倒数第 N 个结点(双指针-快慢指针)
    SpringBoot 服务接口限流
    3.2 AOP之代理模式
    Elasticsearch分词器-中文分词器ik
    微信公众号基本配置之服务器配置
    2023湖南中医药大学计算机考研信息汇总
    Java 和 PHP GC 的差异和差异出现的原因
    RabbitMQ的应用场景
    物理学专业英语(词汇整理)--------07
    ctf web基础php
  • 原文地址:https://blog.csdn.net/weixin_42856871/article/details/127706081