⿊马程序员-传智健康项⽬(第⼀章)
传智健康项⽬
1. 项⽬概述
1.1 项⽬介绍
传智健康管理系统是⼀款应⽤于健康管理机构的业务系统,实现健康管理机构⼯作内容可视化、会员管理专业化、健康评估数字化、健康⼲预流程化、知识库集成化,从⽽提⾼健康管理师的⼯作效率,加强与会员间的互动,增强管理者对健康管理机构运营情况的了解。
详见:资料中的传智健康PRD⽂档.docx
1.2 原型展⽰
参见资料中的静态原型。
1.3 技术架构
1.4 功能架构
1.5 软件开发流程
软件开发⼀般会经历如下⼏个阶段,整个过程是顺序展开,所以通常称为瀑布模型。
2. 环境搭建
2.1 项⽬结构
本项⽬采⽤maven分模块开发⽅式,即对整个项⽬拆分为⼏个maven⼯程,每个maven⼯程存放特定的⼀类代码,具体如下:
各模块职责定位:
health_parent:⽗⼯程,打包⽅式为pom,统⼀锁定依赖的版本,同时聚合其他⼦模块便于统⼀执⾏maven命令
health_common:通⽤模块,打包⽅式为jar,存放项⽬中使⽤到的⼀些⼯具类、实体类、返回结果和常量类
health_interface:打包⽅式为jar,存放服务接⼝
health_service_provider:Dubbo服务模块,打包⽅式为war,存放服务实现类、Dao接⼝、Mapper映射⽂件等,作为服务提供⽅,需要部署到tomcat运⾏
health_backend:传智健康管理后台,打包⽅式为war,作为Dubbo服务消费⽅,存放Controller、HTML页⾯、js、css、spring配置⽂件等,需要部署到tomcat运⾏
health_mobile:移动端前台,打包⽅式为war,作为Dubbo服务消费⽅,存放Controller、HTML页⾯、js、css、spring配置⽂件等,需要部署到tomcat运⾏
2.2 maven项⽬搭建
通过前⾯的项⽬功能架构图可以知道本项⽬分为传智健康管理后台和传智健康前台(端)
2.2.1 health_parent
创建health_parent,⽗⼯程,打包⽅式为pom,⽤于统⼀管理依赖版本
<!--?xml version="1.0" encoding="UTF-8"?-->
<project xmlns="/POM/4.0.0" xmlns:xsi="/2001/XMLSchema-instance" xsi:schemalocation="/POM/4.0.0
/xsd/maven-4.0.0.xsd">
<modelversion>4.0.0</modelversion>
<groupid>com.itheima</groupid>
<artifactid>health_parent</artifactid>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<!-- 集中定义依赖版本号 -->
<properties>
<junit.version>4.12</junit.version>
<spring.version>5.0.5.RELEASE</spring.version>
<pagehelper.version>4.1.4</pagehelper.version>
<servlet-api.version>2.5</servlet-api.version>
<dubbo.version>2.6.0</dubbo.version>
<zookeeper.version>3.4.7</zookeeper.version>
<zkclient.version>0.1</zkclient.version>
<mybatis.version>3.4.5</mybatis.version>
<mybatis.spring.version>1.3.1</mybatis.spring.version>
<mybatis.paginator.version>1.2.15</mybatis.paginator.version>
<mysql.version>5.1.32</mysql.version>
<druid.version>1.0.9</druid.version>
<commons-fileupload.version>1.3.1</commons-fileupload.version>
<spring.security.version>5.0.5.RELEASE</spring.security.version>
<poi.version>3.14</poi.version>
<jedis.version>2.9.0</jedis.version>
<quartz.version>2.2.1</quartz.version>
</properties>
<!-- 依赖管理标签必须加 -->
<dependencymanagement>
<dependencies>
<!-- 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-web</artifactid>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupid>org.springframework</groupid>
java dubbo
<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>
<artifactid>spring-jms</artifactid>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupid>org.springframework</groupid>
<artifactid>spring-context-support</artifactid>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupid>org.springframework</groupid>
<artifactid>spring-test</artifactid>
<version>${spring.version}</version>
</dependency>
<!-- dubbo相关 -->
<dependency>
<groupid>com.alibaba</groupid>
<artifactid>dubbo</artifactid>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupid>keeper</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>junit</groupid>
<artifactid>junit</artifactid>
<version>4.12</version>
</dependency>
<dependency>
<groupid>com.alibaba</groupid>
<artifactid>fastjson</artifactid>
<version>1.2.47</version>
</dependency>
<dependency>
<groupid>javassist</groupid>
<artifactid>javassist</artifactid>
<version>3.12.1.GA</version>
</dependency>
<dependency>
<groupid>commons-codec</groupid>
<artifactid>commons-codec</artifactid>
<version>1.10</version>
</dependency>
<dependency>
<groupid>com.github.pagehelper</groupid>
<artifactid>pagehelper</artifactid>
<version>${pagehelper.version}</version>
</dependency>
<!-- Mybatis -->
<dependency>
<groupid&batis</groupid>
<artifactid>mybatis</artifactid>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupid&batis</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>
<!-- 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>
<!-- ⽂件上传组件 -->
<dependency>
<groupid>commons-fileupload</groupid>
<artifactid>commons-fileupload</artifactid>
<version>${commons-fileupload.version}</version>            </dependency>
<dependency>
<groupid>org.quartz-scheduler</groupid>
<artifactid>quartz</artifactid>
<version>${quartz.version}</version>
</dependency>
<dependency>
<groupid>org.quartz-scheduler</groupid>
<artifactid>quartz-jobs</artifactid>
<version>${quartz.version}</version>
</dependency>
<dependency>
<groupid>com.sun.jersey</groupid>
<artifactid>jersey-client</artifactid>
<version>1.18.1</version>
</dependency>
<dependency>
<groupid>com.qiniu</groupid>
<artifactid>qiniu-java-sdk</artifactid>
<version>7.2.0</version>
</dependency>
<!--POI报表-->
<dependency>
<groupid>org.apache.poi</groupid>
<artifactid>poi</artifactid>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupid>org.apache.poi</groupid>
<artifactid>poi-ooxml</artifactid>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupid>redis.clients</groupid>
<artifactid>jedis</artifactid>
</dependency>
<!-- 安全框架 -->
<dependency>
<groupid>org.springframework.security</groupid>
<artifactid>spring-security-web</artifactid>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupid>org.springframework.security</groupid>
<artifactid>spring-security-config</artifactid>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupid>org.springframework.security</groupid>
<artifactid>spring-security-taglibs</artifactid>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupid>com.github.penggle</groupid>
<artifactid>kaptcha</artifactid>
<version>2.3.2</version>
<exclusions>
<exclusion>
<groupid>javax.servlet</groupid>
<artifactid>javax.servlet-api</artifactid>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupid>dom4j</groupid>
<artifactid>dom4j</artifactid>
<version>1.6.1</version>
</dependency>
<dependency>
<groupid>xml-apis</groupid>
<artifactid>xml-apis</artifactid>
<version>1.4.01</version>
</dependency>
</dependencies>
</dependencymanagement>
<dependencies>
<dependency>
<groupid>javax.servlet</groupid>
<artifactid>servlet-api</artifactid>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- java编译插件 -->
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-compiler-plugin</artifactid>
<version>3.2</version>
<configuration>
<source>1.8
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
2.2.2 health_common
创建health_common,⼦⼯程,打包⽅式为jar,存放通⽤组件,例如⼯具类、实体类等
<!--?xml version="1.0" encoding="UTF-8"?-->
<project xmlns="/POM/4.0.0" xmlns:xsi="/2001/XMLSchema-instance" xsi:schemalocation="/POM/4.0.0    /xsd/maven-4.0.0.
xsd">
<parent>
<artifactid>health_parent</artifactid>
<groupid>com.itheima</groupid>
<version>1.0-SNAPSHOT</version>
</parent>
<modelversion>4.0.0</modelversion>
<artifactid>health_common</artifactid>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupid>com.github.pagehelper</groupid>
<artifactid>pagehelper</artifactid>
</dependency>
<!-- Mybatis -->
<dependency>
<groupid&batis</groupid>
<artifactid>mybatis</artifactid>
</dependency>
<dependency>
<groupid&batis</groupid>
<artifactid>mybatis-spring</artifactid>
</dependency>
<dependency>
<groupid>com.github.miemiedev</groupid>
<artifactid>mybatis-paginator</artifactid>
</dependency>
<!-- MySql -->
<dependency>
<groupid>mysql</groupid>
<artifactid>mysql-connector-java</artifactid>
</dependency>
<!-- 连接池 -->
<dependency>
<groupid>com.alibaba</groupid>
<artifactid>druid</artifactid>
</dependency>
<dependency>
<groupid>commons-fileupload</groupid>
<artifactid>commons-fileupload</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-web</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>
<dependency>
<groupid>org.springframework</groupid>
<artifactid>spring-test</artifactid>
</dependency>
<!-- dubbo相关 -->
<dependency>
<groupid>com.alibaba</groupid>
<artifactid>dubbo</artifactid>
</dependency>
<dependency>
<groupid>keeper</groupid>
<artifactid>zookeeper</artifactid>
</dependency>
<dependency>
<groupid>com.github.sgroschupf</groupid>
<artifactid>zkclient</artifactid>
</dependency>
<dependency>
<groupid>junit</groupid>
<artifactid>junit</artifactid>
</dependency>
<dependency>
<groupid>com.alibaba</groupid>
<artifactid>fastjson</artifactid>
</dependency>
<dependency>
<groupid>javassist</groupid>
<artifactid>javassist</artifactid>
</dependency>
<dependency>
<groupid>commons-codec</groupid>
<artifactid>commons-codec</artifactid>
</dependency>
<dependency>
<groupid>org.apache.poi</groupid>
<artifactid>poi</artifactid>
</dependency>
<dependency>
<groupid>redis.clients</groupid>
<artifactid>jedis</artifactid>
</dependency>
<dependency>
<groupid>com.qiniu</groupid>
<artifactid>qiniu-java-sdk</artifactid>
</dependency>
<dependency>
<groupid>com.sun.jersey</groupid>
<artifactid>jersey-client</artifactid>
</dependency>
<dependency>
<groupid>org.apache.poi</groupid>
<artifactid>poi-ooxml</artifactid>
</dependency>
<dependency>
<groupid>org.springframework.security</groupid>
<artifactid>spring-security-web</artifactid>
</dependency>
<dependency>
<groupid>org.springframework.security</groupid>
<artifactid>spring-security-config</artifactid>
</dependency>
<dependency>
<groupid>org.springframework.security</groupid>
<artifactid>spring-security-taglibs</artifactid>
</dependency>
</dependencies>
</project>
2.2.5 health_interface
创建health_interface,⼦⼯程,打包⽅式为jar,存放服务接⼝
<!--?xml version="1.0" encoding="UTF-8"?-->
<project xmlns="/POM/4.0.0" xmlns:xsi="/2001/XMLSchema-instance" xsi:schemalocation="/POM/4.0.0                            /xsd/maven-4.0.0.xsd">
<parent>
<artifactid>health_parent</artifactid>
<groupid>com.itheima</groupid>
<version>1.0-SNAPSHOT</version>
</parent>
<modelversion>4.0.0</modelversion>
<artifactid>health_interface</artifactid>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupid>com.itheima</groupid>
<artifactid>health_common</artifactid>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
2.2.6 health_service_provider
创建health_service_provider,⼦⼯程,打包⽅式为war,作为服务单独部署,存放服务类、Dao接⼝和Mapper映射⽂件等
<!--?xml version="1.0" encoding="UTF-8"?-->
<project xmlns="/POM/4.0.0" xmlns:xsi="/2001/XMLSchema-instance" xsi:schemalocation="/POM/4.0.0                            /xsd/maven-4.0.0.xsd">
<parent>
<groupid>com.itheima</groupid>
<artifactid>health_parent</artifactid>
<version>1.0-SNAPSHOT</version>
</parent>
<modelversion>4.0.0</modelversion>
<artifactid>health_service_provider</artifactid>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupid>com.itheima</groupid>
<artifactid>health_interface</artifactid>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupid>at.maven</groupid>
<artifactid>tomcat7-maven-plugin</artifactid>
<configuration>
<!-- 指定端⼝ -->
<port>81</port>
<!-- 请求路径 -->
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
</project>
log4j.properties
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file mylog.log ###
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=c:\\mylog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-////DTD Config 3.0//EN"
"/dtd/mybatis-3-config.dtd">
<configuration>
<plugins>
<!-- com.github.pagehelper 为 PageHelper 类所在包名 -->
<plugin interceptor="com.github.pagehelper.PageHelper">
<!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL 六种数据库-->
<property name="dialect" value="mysql"/>
</plugin>
</plugins>
</configuration>
<!--?xml version="1.0" encoding="UTF-8"?-->
<beans xmlns="/schema/beans" xmlns:context="/schema/context" xmlns:p="/schema/p" xmlns:aop="/sch
ema/aop" x        /schema/beans/spring-beans-4.2.xsd
/schema/context
/schema/context/spring-context.xsd
/schema/aop
/schema/aop/spring-aop.xsd
/schema/tx
/schema/tx/spring-tx.xsd
/schema/util
/schema/util/spring-util.xsd">
<!--数据源-->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
<property name="username" value="root">
<property name="password" value="root">
<property name="driverClassName" value="sql.jdbc.Driver">
<property name="url" value="jdbc:mysql://localhost:3306/health">
</property></property></property></property></bean>
<!--spring和mybatis整合的⼯⼚bean-->
<bean id="sqlSessionFactory" class="batis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource">
<property name="configLocation" value="l">
</property></property></bean>
<!--批量扫描接⼝⽣成代理对象-->
<bean class="batis.spring.mapper.MapperScannerConfigurer">
<!--指定接⼝所在的包-->
<property name="basePackage" value="com.itheima.dao">
</property></bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="/schema/beans"
xmlns:xsi="/2001/XMLSchema-instance"
xmlns:context="/schema/context"
xmlns:tx="/schema/tx"
xmlns:mvc="/schema/mvc"
xsi:schemaLocation="/schema/beans
/schema/beans/spring-beans.xsd
/schema/mvc
/schema/mvc/spring-mvc.xsd
/schema/tx
/schema/tx/spring-tx.xsd
/schema/context
/schema/context/spring-context.xsd">
<!-- 事务管理器  -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!--
开启事务控制的注解⽀持
注意:此处必须加⼊proxy-target-class="true",
需要进⾏事务控制,会由Spring框架产⽣代理对象,
Dubbo需要将Service发布为服务,要求必须使⽤cglib创建代理对象。
-->
<tx:annotation-driven transaction-manager="transactionManager"
proxy-target-class="true"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="/schema/beans"
xmlns:xsi="/2001/XMLSchema-instance"
xmlns:context="/schema/context"
xmlns:dubbo="code.alibabatech/schema/dubbo"
xmlns:mvc="/schema/mvc"

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。