实战项目商城(第一天)

主要的模块:

后台管理系统:管理商品、订单、类目、商品规格属性、用户管理以及内容发布等功能。

前台系统:用户可以在前台系统中进行注册、登录、浏览商品、首页、下单等操作。

会员系统:用户可以在该系统中查询已下的订单、收藏的商品、我的优惠券、团购等信息。

订单系统:提供下单、查询订单、修改订单状态、定时处理订单。

搜索系统:提供商品的搜索功能。

单点登录系统:为多个系统之间提供用户登录凭证以及查询登录用户的信息。


 技术选型(主要技术)


  • SpringSpringMVCMybatis

  • JSPJSTLjQueryjQuery pluginEasyUIKindEditor(富文本编辑器)、CSS+DIV

  • Redis(缓存服务器)

  • Solr(搜索)

  • httpclient(调用系统服务)

  • Mysql

  • Nginxweb服务器)

 开发工具和环境

Eclipse 4.5.0(Mars),自带maven插件,需要手工安装svn插件。

Maven 3.3.3(开发工具自带)

Tomcat 7.0.53Maven Tomcat Plugin

JDK 1.7

Mysql 5.6

Nginx 1.8.0

Redis 3.0.0

Win7操作系统

SVN(版本管理)

后台管理系统工程结构

maven管理的好处

1、项目构建。Maven定义了软件开发的整套流程体系,并进行了封装,开发人员只需要指定项目的构建流程,无需针对每个流程编写自己的构建脚本。

2、依赖管理。除了项目构建,Maven最核心的功能是软件包的依赖管理,能够自动分析项目所需要的依赖软件包,并到Maven中心仓库去下载。

A)管理依赖的jar包

B)管理工程之间的依赖关系。


创建taotao-parent

  创建maven工程(所有的工程都会继承这个目录,这是一个总的目录用pom)



然后修改pom.xml文件:

<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.0http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.taotao</groupId>
      <artifactId>taotao-parent</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>pom</packaging>
      <!-- 集中定义依赖版本号 -->
      <properties>
            <junit.version>4.12</junit.version>
            <spring.version>4.1.3.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-fix</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>
      </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>
                  <!-- 单元测试 -->
                  <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>
                  <!-- 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>
            </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>
将taotao-parent安装到本地仓库。

右键->runas->Maven install

创建taotao-common(这是一个通用的库,存放所有工程通用的jar,能够被调用jar,打包成通用的jar包)



修改pom.xml文件
<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>com.taotao</groupId>
    <artifactId>taotao-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <groupId>com.taotao</groupId>
  <artifactId>taotao-common</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <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>
			<!-- 单元测试 -->
			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
			
				<scope>test</scope>
			</dependency>
			<!-- 日志处理 -->
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-log4j12</artifactId>
		
			</dependency>
  </dependencies>
  
</project>



taotao-manage(project)

 创建taotao-manager(这是一个聚合父类,继承parent,依赖与common,为pom)



修改pom.xml文件
 <!-- 依赖管理 -->
  <dependencies>
  	<dependency>
  		<groupId>com.taotao</groupId>
  		<artifactId>taotao-common</artifactId>
  		<version>0.0.1-SNAPSHOT</version>
  	</dependency>
  </dependencies>
  <modules>
  	<module>taotao-manager-pojo</module>
  	<module>taotao-manager-mapper</module>
  	<module>taotao-manager-service</module>
  	<module>taotao-manager-web</module>
  </modules>
  <build>
  <!-- 配置插件 -->
  	<plugins>
  		<plugin>
  			<groupId>org.apache.tomcat.maven</groupId>
			<artifactId>tomcat7-maven-plugin</artifactId>
			<configuration>
				<port>8080</port>
				<path>/</path>
			</configuration>
  		</plugin>
  	</plugins>
  </build>

taotao-manage-pojo(jar包类,继承parent) new mevan module



Taotao-manager-mapper(是jar包,依赖与pojo)new mevan module


<!-- 依赖管理 -->
  <dependencies>
  	<dependency>
  		<groupId>com.taotao</groupId>
		<artifactId>taotao-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>
  </dependencies>


Taotao-manager-service(jar包,依赖与mapper)new mevan module


<!-- 依赖管理 -->
  <dependencies>
  	<dependency>
  		<groupId>com.taotao</groupId>
  		<artifactId>taotao-manager-mapper</artifactId>
  		<version>0.0.1-SNAPSHOT</version>
  	</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>
  </dependencies>


Taotao-manager-web(war包,聚合这几个包,依赖于service)new mevan module


<!-- 依赖管理 -->
  <dependencies>
  	<dependency>
  		<groupId>com.taotao</groupId>
  		<artifactId>taotao-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>
			<!-- 文件上传组件 -->
			<dependency>
				<groupId>commons-fileupload</groupId>
				<artifactId>commons-fileupload</artifactId>
			
			</dependency>
  </dependencies>
配置web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="taotao" version="2.5">
	<display-name>taotao-manager</display-name>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>

</web-app>

运行web工程需要添加一个tomcat插件。插件必须添加到taotao-manager工程中。因为taotao-manager是聚合工程。在运行时需要把子工程聚合到一起才能运行。

启动tomcat命令:tomcat7:run

还要将项目添加到本地的仓库中:mevan build

SVN的使用












评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值