zoukankan      html  css  js  c++  java
  • e3商城_day01

    一.电商模式

     二.功能列表

    三.系统架构演变

      》传统架构:

       1000并发:

     注意:这里的不同服务器一般都是在不同的主机上的,不同服务器的工程都是一模一样的;配置多台服务器的方式叫做集群

      10000并发:

         1.如果是1w并发的话,刚才配置多个服务器的方式就不太管用了

        2.要实现1w并发,得把架构给改了:将一个项目根据业务拆分成不同的模块(系统),每个节点(系统)分配不同数量的服务器来支持并发,比如:前台系统所需的服务器可能较多(也可以采用缓存的机制来减少服务器的压力),后退系统相对较少

        3.像刚才的session共享问题,就可以将session完全交付给登录系统来统一管理,就不需要通过session复制的方式了

        4.之前不同的系统在同一台服务器上,实现服务(service)间的调用就直接调了,但是现在不同的系统分配到不同的服务器,想实现系统间的通信可以采用WebService或Socket的方式来调用服务

        5.需要按照功能点进行系统划分,拆分独立的功能(系统),单独为某一节点(系统)分配一定数量的服务器,服务器之间互相通信来完成整个项目业务的逻辑,叫做分布式。

      》面向SOA的架构(面向服务的架构)

         1.像刚才系统拆分的方法有一个缺点:当不同的系统是有相同的业务逻辑时(比如:订单系统和前台系统都需要查询商品的信息),会导致相同服务没有实现共享,而是有各自有自己的服务。

        2.为了服务共享的问题,SAO架构出现了;它把表现层和服务层拆解出来,不同的表现层(系统)处理好自己的页面请求,无需关心业务逻辑,服务层的不同服务实现不同的业务逻辑,提供WebService接口或jar包的方式给外面调用。

        3.一般服务层的不同服务是分配不同数量的服务器来支持的,服务层的服务并不单单是service,还有dao,pojo等

    四.项目的整体架构

    五.使用tomcat插件运行聚合过程

      》创建好parent父过程,子过程是common,manager,manager下包括多个子模块,分别是:pojo,dao,service,interface,web

      》为每个pom.xml文件添加内容等,这里不详细说,最后面会有所有pom.xml的展示

      》我们使用tomcat插件来运行项目,一般项目可用来运行的有两类:聚合工程(它的子模块有web工程)和web工程,我们建议优先运行聚合工程,原因是:聚合工程是可直接运行,不需要把工程下的子模块发布到本地库,若运行聚合工程下的web工程,web肯定会依赖同级子模块的,需要将同级子模块给安装到本地库

    PS:tomcat插件的配置在聚合工程或web工程的pom.xml中,父工程和jar是不能运行的

    六.Mybatis逆向工程

      》创建数据库,执行sql脚本创建表

      》通过逆向工程代码生成接口,配置文件以及pojo

      》逆向工程只执行一次,如果执行了多次请重新删除原来生成的文件,再重新执行

    七.ssm整合

       》像上面的sqlMapConfig,applictionContext-*,springmvc等xml文件,我们原本是不同的配置文件放到对应的子模块中,比如sqlMapConfig.xml放在dao模块,但是除了web模块外,其他都会达成jar,到时候进行访问jar里面的配置文件就不是那么方便了,所以在这里我们统一把配置文件放到web模块中

      》各个配置文件的配置内容:

        1.sqlMapConfig:为pojo包取别名

        2.applicationContext-dao:引用db,properties,配置连接池,配置session工厂,配置mapper扫描器

        3.applicationContext-service:扫描service包下的组件,component-san

        4.applicationContext-transaction:配置事务管理器,配置通知,配置切面(织入)

        5.springmvc:配置三大组件,分别是controller扫描器,mvc驱动(映射器和适配器),视图解析器

        6.web.xml:配置前端控制器,spring加载的监听器contextLoaderListenner,post乱码的过滤器

    八.各层的pom.xml

    >parent:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>cn.e3mall</groupId>
        <artifactId>e3-parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>pom</packaging>
        <!-- 集中定义依赖版本号 -->
        <properties>
            <junit.version>4.12</junit.version>
            <spring.version>4.2.4.RELEASE</spring.version>
            <mybatis.version>3.2.8</mybatis.version>
            <mybatis.spring.version>1.2.2</mybatis.spring.version>
            <mybatis.paginator.version>1.2.15</mybatis.paginator.version>
            <mysql.version>5.1.32</mysql.version>
            <slf4j.version>1.6.4</slf4j.version>
            <jackson.version>2.4.2</jackson.version>
            <druid.version>1.0.9</druid.version>
            <httpclient.version>4.3.5</httpclient.version>
            <jstl.version>1.2</jstl.version>
            <servlet-api.version>2.5</servlet-api.version>
            <jsp-api.version>2.0</jsp-api.version>
            <joda-time.version>2.5</joda-time.version>
            <commons-lang3.version>3.3.2</commons-lang3.version>
            <commons-io.version>1.3.2</commons-io.version>
            <commons-net.version>3.3</commons-net.version>
            <pagehelper.version>3.4.2</pagehelper.version>
            <jsqlparser.version>0.9.1</jsqlparser.version>
            <commons-fileupload.version>1.3.1</commons-fileupload.version>
            <jedis.version>2.7.2</jedis.version>
            <solrj.version>4.10.3</solrj.version>
            <dubbo.version>2.5.3</dubbo.version>
            <zookeeper.version>3.4.7</zookeeper.version>
            <zkclient.version>0.1</zkclient.version>
            <activemq.version>5.11.2</activemq.version>
            <freemarker.version>2.3.23</freemarker.version>
            <quartz.version>2.2.2</quartz.version>
        </properties>
        <dependencyManagement>
            <dependencies>
                <!-- 时间操作组件 -->
                <dependency>
                    <groupId>joda-time</groupId>
                    <artifactId>joda-time</artifactId>
                    <version>${joda-time.version}</version>
                </dependency>
                <!-- Apache工具组件 -->
                <dependency>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                    <version>${commons-lang3.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-io</artifactId>
                    <version>${commons-io.version}</version>
                </dependency>
                <dependency>
                    <groupId>commons-net</groupId>
                    <artifactId>commons-net</artifactId>
                    <version>${commons-net.version}</version>
                </dependency>
                <!-- Jackson Json处理工具包 -->
                <dependency>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                    <version>${jackson.version}</version>
                </dependency>
                <!-- httpclient -->
                <dependency>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpclient</artifactId>
                    <version>${httpclient.version}</version>
                </dependency>
                <!-- quartz任务调度框架 -->
                <dependency>
                    <groupId>org.quartz-scheduler</groupId>
                    <artifactId>quartz</artifactId>
                    <version>${quartz.version}</version>
                </dependency>
                <!-- 单元测试 -->
                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>${junit.version}</version>
                    <scope>test</scope>
                </dependency>
                <!-- 日志处理 -->
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                    <version>${slf4j.version}</version>
                </dependency>
                <!-- Mybatis -->
                <dependency>
                    <groupId>org.mybatis</groupId>
                    <artifactId>mybatis</artifactId>
                    <version>${mybatis.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.mybatis</groupId>
                    <artifactId>mybatis-spring</artifactId>
                    <version>${mybatis.spring.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.github.miemiedev</groupId>
                    <artifactId>mybatis-paginator</artifactId>
                    <version>${mybatis.paginator.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.github.pagehelper</groupId>
                    <artifactId>pagehelper</artifactId>
                    <version>${pagehelper.version}</version>
                </dependency>
                <!-- MySql -->
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>${mysql.version}</version>
                </dependency>
                <!-- 连接池 -->
                <dependency>
                    <groupId>com.alibaba</groupId>
                    <artifactId>druid</artifactId>
                    <version>${druid.version}</version>
                </dependency>
                <!-- Spring -->
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                    <version>${spring.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                    <version>${spring.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-webmvc</artifactId>
                    <version>${spring.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-jdbc</artifactId>
                    <version>${spring.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-aspects</artifactId>
                    <version>${spring.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-jms</artifactId>
                    <version>${spring.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context-support</artifactId>
                    <version>${spring.version}</version>
                </dependency>
                <!-- JSP相关 -->
                <dependency>
                    <groupId>jstl</groupId>
                    <artifactId>jstl</artifactId>
                    <version>${jstl.version}</version>
                </dependency>
                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                    <version>${servlet-api.version}</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>jsp-api</artifactId>
                    <version>${jsp-api.version}</version>
                    <scope>provided</scope>
                </dependency>
                <!-- 文件上传组件 -->
                <dependency>
                    <groupId>commons-fileupload</groupId>
                    <artifactId>commons-fileupload</artifactId>
                    <version>${commons-fileupload.version}</version>
                </dependency>
                <!-- Redis客户端 -->
                <dependency>
                    <groupId>redis.clients</groupId>
                    <artifactId>jedis</artifactId>
                    <version>${jedis.version}</version>
                </dependency>
                <!-- solr客户端 -->
                <dependency>
                    <groupId>org.apache.solr</groupId>
                    <artifactId>solr-solrj</artifactId>
                    <version>${solrj.version}</version>
                </dependency>
                <!-- dubbo相关 -->
                <dependency>
                    <groupId>com.alibaba</groupId>
                    <artifactId>dubbo</artifactId>
                    <version>${dubbo.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.zookeeper</groupId>
                    <artifactId>zookeeper</artifactId>
                    <version>${zookeeper.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.github.sgroschupf</groupId>
                    <artifactId>zkclient</artifactId>
                    <version>${zkclient.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.activemq</groupId>
                    <artifactId>activemq-all</artifactId>
                    <version>${activemq.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.freemarker</groupId>
                    <artifactId>freemarker</artifactId>
                    <version>${freemarker.version}</version>
                </dependency>
    
            </dependencies>
        </dependencyManagement>
    
        <build>
            <finalName>${project.artifactId}</finalName>
            <plugins>
                <!-- 资源文件拷贝插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.7</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <!-- java编译插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
            <pluginManagement>
                <plugins>
                    <!-- 配置Tomcat插件 -->
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat7-maven-plugin</artifactId>
                        <version>2.2</version>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
    </project>

    >common

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>cn.e3mall</groupId>
        <artifactId>e3-parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
      <artifactId>e3-common</artifactId>
      
      <!-- 依赖的jar包 -->
        <dependencies>
            <!-- 时间操作组件 -->
            <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
            </dependency>
            <!-- Apache工具组件 -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-io</artifactId>
            </dependency>
            <dependency>
                <groupId>commons-net</groupId>
                <artifactId>commons-net</artifactId>
            </dependency>
            <!-- Jackson Json处理工具包 -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
            </dependency>
            <!-- httpclient -->
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
            </dependency>
            <!-- quartz任务调度框架 -->
            <dependency>
                <groupId>org.quartz-scheduler</groupId>
                <artifactId>quartz</artifactId>
            </dependency>
            <!-- 单元测试 -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <scope>test</scope>
            </dependency>
            <!-- 日志处理 -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </dependency>
    
        </dependencies>
    </project>

    >manager

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>cn.e3mall</groupId>
        <artifactId>e3-parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
      <artifactId>e3-manager</artifactId>
      <packaging>pom</packaging>
      
        <!-- 依赖工具类 -->
      <dependencies>
          <dependency>
              <groupId>cn.e3mall</groupId>
            <artifactId>e3-common</artifactId>
            <version>0.0.1-SNAPSHOT</version>
          </dependency>
      
      </dependencies>
      <modules>
          <module>e3-manager-pojo</module>
          <module>e3-manager-dao</module>
          <module>e3-manager-interface</module>
          <module>e3-manager-service</module>
          <module>e3-manager-web</module>
      </modules>
      
      <build>
          <!-- 配置Tomcat插件 -->
          <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <configuration>
                    <path>/</path>
                    <port>8080</port>
                </configuration>
            </plugin>
        </plugins>
      </build>
    </project>

    >dao

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>cn.e3mall</groupId>
        <artifactId>e3-manager</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
      <artifactId>e3-manager-dao</artifactId>
      
          <dependencies>
            <dependency>
                <groupId>cn.e3mall</groupId>
                <artifactId>e3-manager-pojo</artifactId>
                <version>0.0.1-SNAPSHOT</version>
            </dependency>
            <!-- Mybatis -->
            <dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis</artifactId>
            </dependency>
            <dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis-spring</artifactId>
            </dependency>
            <dependency>
                <groupId>com.github.miemiedev</groupId>
                <artifactId>mybatis-paginator</artifactId>
            </dependency>
            <dependency>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper</artifactId>
            </dependency>
            <!-- MySql -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
            </dependency>
            <!-- 连接池 -->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
            </dependency>
            <!-- Spring -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aspects</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jms</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context-support</artifactId>
            </dependency>
        </dependencies>
    </project>

    >pojo

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>cn.e3mall</groupId>
        <artifactId>e3-manager</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
      <artifactId>e3-manager-pojo</artifactId>
    </project>

    >service

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>cn.e3mall</groupId>
        <artifactId>e3-manager</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
      <artifactId>e3-manager-service</artifactId>
      
      <!-- 依赖dao -->
      <!-- 依赖pojo:传递依赖 -->
      <!-- 依赖service接口 -->
      <!-- 依赖spring:传递依赖 -->
      
          <dependencies>
              <!-- 依赖dao -->
            <dependency>
                <groupId>cn.e3mall</groupId>
                <artifactId>e3-manager-dao</artifactId>
                <version>0.0.1-SNAPSHOT</version>
            </dependency>
            <!-- 依赖service接口 -->
            <dependency>
                <groupId>cn.e3mall</groupId>
                <artifactId>e3-manager-interface</artifactId>
                <version>0.0.1-SNAPSHOT</version>
            </dependency>
            
        </dependencies>    
    </project>

    >interface

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>cn.e3mall</groupId>
        <artifactId>e3-manager</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
      <artifactId>e3-manager-interface</artifactId>
      
      <!-- 依赖pojo -->
        <dependencies>
            <dependency>
                <groupId>cn.e3mall</groupId>
                <artifactId>e3-manager-pojo</artifactId>
                <version>0.0.1-SNAPSHOT</version>
            </dependency>
        </dependencies>
      <!-- service接口不需要依赖dao -->
    </project>

    >web

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>cn.e3mall</groupId>
        <artifactId>e3-manager</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
      <artifactId>e3-manager-web</artifactId>
      <packaging>war</packaging>
      
      <!-- 依赖service -->
      <!-- 依赖spring:传递依赖 -->
      <!-- 依赖jsp相关的jar -->
      <!-- 依赖pojo:传递依赖  -->
      
      <dependencies>
            <dependency>
                <groupId>cn.e3mall</groupId>
                <artifactId>e3-manager-service</artifactId>
                <version>0.0.1-SNAPSHOT</version>
            </dependency>
            <!-- JSP相关 -->
            <dependency>
                <groupId>jstl</groupId>
                <artifactId>jstl</artifactId>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jsp-api</artifactId>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </project>
  • 相关阅读:
    是用VLC API将RTSP流convert为视频文件
    VLC命令行的应用
    OpenRTSP的使用
    (3两个例子)从零开始的嵌入式图像图像处理(PI+QT+OpenCV)实战演练
    寻找轮廓的中点
    (4程序框架)从零开始的嵌入式图像图像处理(PI+QT+OpenCV)实战演练
    (2环境架设)从零开始的嵌入式图像图像处理(PI+QT+OpenCV)实战演练
    (1综述)从零开始的嵌入式图像图像处理(PI+QT+OpenCV)实战演练
    初步实现GoQtTemplate
    特征提取算法的综合实验(多种角度比较sift/surf/brisk/orb/akze)
  • 原文地址:https://www.cnblogs.com/ibcdwx/p/13308416.html
Copyright © 2011-2022 走看看