• CRM项目记录(一)



    目录:

    (1)CRM技术架构 

    (2)CRM软件开发生命周期

    (3)CRM 物理结构设计

     (4)搭建开发环境


    (1)CRM技术架构 

     (2)CRM软件开发生命周期

     

     

     

    (3)CRM 物理结构设计

     

     

     (4)搭建开发环境

    首先创建一个空的项目:

    创建工程:Module:

     选择Maven骨架:

     

     

     补全目录:创建目录:

     添加依赖:pom.xml:

    1. "1.0" encoding="UTF-8"?>
    2. "http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    4. 4.0.0
    5. com.bjpowernode.crm
    6. crm
    7. 1.0-SNAPSHOT
    8. war
    9. crm Maven Webapp
    10. http://www.example.com
    11. UTF-8
    12. 1.7
    13. 1.7
    14. junit
    15. junit
    16. 4.11
    17. test
    18. mysql
    19. mysql-connector-java
    20. 5.1.43
    21. com.alibaba
    22. druid
    23. 1.1.1
    24. org.mybatis
    25. mybatis
    26. 3.4.1
    27. org.springframework
    28. spring-context
    29. 4.3.9.RELEASE
    30. org.springframework
    31. spring-aop
    32. 4.3.9.RELEASE
    33. org.springframework
    34. spring-core
    35. 4.3.9.RELEASE
    36. org.springframework
    37. spring-beans
    38. 4.3.9.RELEASE
    39. org.springframework
    40. spring-jdbc
    41. 4.3.9.RELEASE
    42. org.springframework
    43. spring-tx
    44. 4.3.9.RELEASE
    45. org.springframework
    46. spring-web
    47. 4.3.9.RELEASE
    48. org.springframework
    49. spring-webmvc
    50. 4.3.9.RELEASE
    51. org.springframework
    52. spring-oxm
    53. 4.3.9.RELEASE
    54. org.aspectj
    55. aspectjweaver
    56. 1.8.9
    57. org.mybatis
    58. mybatis-spring
    59. 1.3.0
    60. javax.servlet
    61. javax.servlet-api
    62. 3.1.0
    63. javax.servlet.jsp.jstl
    64. jstl-api
    65. 1.2
    66. org.apache.taglibs
    67. taglibs-standard-spec
    68. 1.2.1
    69. org.apache.taglibs
    70. taglibs-standard-impl
    71. 1.2.1
    72. com.fasterxml.jackson.core
    73. jackson-core
    74. 2.7.3
    75. com.fasterxml.jackson.core
    76. jackson-databind
    77. 2.7.3
    78. com.fasterxml.jackson.core
    79. jackson-annotations
    80. 2.7.3
    81. org.apache.poi
    82. poi
    83. 3.15
    84. commons-fileupload
    85. commons-fileupload
    86. 1.3.1
    87. org.apache.logging.log4j
    88. log4j-api
    89. 2.3
    90. org.apache.logging.log4j
    91. log4j-core
    92. 2.3
    93. org.apache.logging.log4j
    94. log4j-jcl
    95. 2.3
    96. crm
    97. maven-clean-plugin
    98. 3.1.0
    99. maven-resources-plugin
    100. 3.0.2
    101. maven-compiler-plugin
    102. 3.8.0
    103. maven-surefire-plugin
    104. 2.22.1
    105. maven-war-plugin
    106. 3.2.2
    107. maven-install-plugin
    108. 2.5.2
    109. maven-deploy-plugin
    110. 2.8.2

    设置项目编码: 

    添加配置文件: 

    在resources目录下创建 

     创建Mybatis的配置文件:

    mybatis-config.xml:

    1. "1.0" encoding="UTF-8" ?>
    2. PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
    3. "http://mybatis.org/dtd/mybatis-3-config.dtd">
    4. "logImpl" value="STDOUT_LOGGING"/>
    5. <package name="com.bjpowernode.crm.model"/>
    6. <package name="com.bjpowernode.crm.mapper"/>

    配置数据连接和事务,创建配置文件:applicationContext-datasource.xml

    1. "1.0" encoding="UTF-8"?>
    2. "http://www.springframework.org/schema/beans"
    3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    4. xmlns:aop="http://www.springframework.org/schema/aop"
    5. xmlns:context="http://www.springframework.org/schema/context"
    6. xmlns:tx="http://www.springframework.org/schema/tx"
    7. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    8. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
    9. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    10. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
    11. "dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    12. "driverClassName" value="com.mysql.jdbc.Driver"/>
    13. "username" value="root"/>
    14. "password" value="123456"/>
    15. "url" value="jdbc:mysql://192.168.223.133:3306/crm_db?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/>
    16. "sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    17. "dataSource" ref="dataSource"/>
    18. "configLocation" value="classpath:mybatis-config.xml"/>
    19. "mapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    20. "basePackage" value="com.bjpowernode.crm.mapper"/>
    21. "sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
    22. "transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    23. "dataSource" ref="dataSource"/>
    24. "execution(* com.bjpowernode.crm..service.*.*(..))" id="allMethodPointcut"/>
    25. "txAdvice" pointcut-ref="allMethodPointcut"/>
    26. "txAdvice" transaction-manager="transactionManager">
    27. "add*" propagation="REQUIRED" rollback-for="Exception"/>
    28. "save*" propagation="REQUIRED" rollback-for="Exception"/>
    29. "edit*" propagation="REQUIRED" rollback-for="Exception"/>
    30. "update*" propagation="REQUIRED" rollback-for="Exception"/>
    31. "delete*" propagation="REQUIRED" rollback-for="Exception"/>
    32. "do*" propagation="REQUIRED" rollback-for="Exception"/>
    33. "*" propagation="REQUIRED" read-only="true"/>

     springmvc 配置:

    applicationContext-mvc.xml

    1. "1.0" encoding="UTF-8"?>
    2. "http://www.springframework.org/schema/beans"
    3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xmlns:p="http://www.springframework.org/schema/p"
    6. xmlns:util="http://www.springframework.org/schema/util"
    7. xmlns:aop="http://www.springframework.org/schema/aop"
    8. xmlns:tx="http://www.springframework.org/schema/tx"
    9. xmlns:mvc="http://www.springframework.org/schema/mvc"
    10. xsi:schemaLocation="
    11. http://www.springframework.org/schema/beans
    12. http://www.springframework.org/schema/beans/spring-beans.xsd
    13. http://www.springframework.org/schema/context
    14. http://www.springframework.org/schema/context/spring-context.xsd
    15. http://www.springframework.org/schema/tx
    16. http://www.springframework.org/schema/tx/spring-tx.xsd
    17. http://www.springframework.org/schema/aop
    18. http://www.springframework.org/schema/aop/spring-aop.xsd
    19. http://www.springframework.org/schema/mvc
    20. http://www.springframework.org/schema/mvc/spring-mvc.xsd
    21. http://www.springframework.org/schema/util
    22. http://www.springframework.org/schema/util/spring-util.xsd">
    23. default-servlet-handler />
    24. package="com.bjpowernode.crm.web.controller"/>
    25. "viewResolver"
    26. class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    27. "prefix" value="/WEB-INF/pages/"/>
    28. "suffix" value=".jsp"/>

    spring 总配置文件:applicationContext.xml

    1. "1.0" encoding="UTF-8"?>
    2. "http://www.springframework.org/schema/beans"
    3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xmlns:p="http://www.springframework.org/schema/p"
    6. xmlns:aop="http://www.springframework.org/schema/aop"
    7. xmlns:tx="http://www.springframework.org/schema/tx"
    8. xmlns:task="http://www.springframework.org/schema/task"
    9. xsi:schemaLocation="
    10. http://www.springframework.org/schema/beans
    11. http://www.springframework.org/schema/beans/spring-beans.xsd
    12. http://www.springframework.org/schema/context
    13. http://www.springframework.org/schema/context/spring-context.xsd
    14. http://www.springframework.org/schema/tx
    15. http://www.springframework.org/schema/tx/spring-tx.xsd
    16. http://www.springframework.org/schema/aop
    17. http://www.springframework.org/schema/aop/spring-aop.xsd">
    18. package="com.bjpowernode.crm.service" />
    19. <import resource="applicationContext-datasource.xml" />

    web.xml的核心配置文件:

    1. "1.0" encoding="UTF-8"?>
    2. "http://www.w3.org/2001/XMLSchema-instance"
    3. xmlns="http://java.sun.com/xml/ns/javaee"
    4. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    5. http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    6. id="dataservice" version="3.0">
    7. dataservice application
    8. contextConfigLocation
    9. classpath:applicationContext.xml
    10. org.springframework.web.context.ContextLoaderListener
    11. encodingFilter
    12. org.springframework.web.filter.CharacterEncodingFilter
    13. encoding
    14. UTF-8
    15. encodingFilter
    16. /*
    17. dispatcher
    18. org.springframework.web.servlet.DispatcherServlet
    19. contextConfigLocation
    20. classpath:applicationContext-mvc.xml
    21. 1
    22. dispatcher
    23. /
    24. dispatcher
    25. *.do
    26. /

    web.xml中加载 appllicationContext.xml、applicationContext-mvc.xml

    当appllicationContext.xml加载的时候加载applicationContext-datasource.xml,当applicationContext-datasource.xml加载的时候加载mybatis-config.xml。这样当服务器启动后,加载web.xml,就把所有的配置文件都加载进来了,

    设置maven对配置文件的编译选项

    让Maven为我们编译配置文件,Maven默认只会编译java源文件,配置文件不会编译,需要设置

    在pom.xml中添加:

     添加静态页面:

     我们的项目部署tomcat上的webapps目录下,我们部署的的时候,IDEA和Maven会把webapp目录下所有东西都考到webapps目录下这个项目的名字下面

    为了安全,把页面放到WEB-INF目录下面,这样外界就不能直接访问了 ,但是正常的访问页面怎么访问呢?提供Controller,进行验证访问,通过controller访问,css和images不用放到WEB-INF目录下,不需要保护

    部署项目到tomcat服务器:

     

    运行:web.xml配置了默认访问controller 中的/,因为没有配置报404

     

     

  • 相关阅读:
    RHCE(五)HTTP、SSL协议综合实验
    使用Unity和纯ECS框架重新打造简单RTS游戏:从零开始的详细C#编程教程
    CVPR2022车道线检测SOTA工作CLRNet在Tusimple数据集测试demo,助力自动驾驶早日落地
    postgis数据库导出csv表再导入postgis
    云呐|机房监控服务平台,机房监控服务平台有哪些
    【论文阅读】Hypergraph Convolutional Network for Group Recommendation
    Cesium 展示——根据文件中的 count 对加载的每个实体赋予不同的颜色
    缺陷检测相关论文阅读总结(记录自己读过的论文主要内容/Ideas)
    NLP教程(3) - 神经网络与反向传播
    多线程和线程池
  • 原文地址:https://blog.csdn.net/dengfengling999/article/details/126919374