1--はじめと環境準備ERPシステム

1. ERP導入

        ERPシステムは、エンタープライズ・リソース・プランニング(エンタープライズ・リソース・プランニング)と呼ばれ、およびビジネス意思決定管理プラットフォームのための体系的管理の考え方、意思決定ランニング手段とスタッフの情報技術に基づいて構築されています。

        ERPシステム1における統合情報技術と高度な管理のアイデア、現代の企業走行モード、社会的富の要件の作成を最大化するために、リソースの企業合理的な配分の時代を反映し、情報化時代に発展の礎を生き残るためのビジネス。それは重要な役割を持っている企業のコア競争力を強化し、ビジネスプロセスを改善することです。ERPシステムは密接にビジネスや産業、商業の企業として、当社の位置決めシステム業界と関連しているよう。

業務システムのいくつかの基本的な概念

1.サプライヤー:あなたの売り手、あなたは企業に原材料を提供します

2.顧客:あなたのバイヤーは、オブジェクトを販売したいです

3.調達:ショッピング

4.販売:販売

5.注文:発注書、受注

常識の3.ソフトウェアプロジェクト

3.1一般的な開発プロセス

要求分析 - >ソフトウェア設計 - >エンコード - >テスト - >ライン上 - >システムメンテナンス

3.2要求分析

        いわゆるニーズ分析、あなたが最終的な出力がどうあるべきか、どんな結果を得るために、入力する必要があるデータの種類を含めた詳細な分析、要件の問題を把握し、解決すべき問題を指します。我々は、ニーズ分析をする前に、システムの作業を行う必要があると言うことができ、ソフトウェア工学解析における要件の中でコンピュータが何をすべきかを決定することであると言う、と効果のどのようなあなたが達成したいことができます。

3.3要件の仕様

        要求仕様の調製は、両側が全体の開発努力のための基礎作り、オリジナルのソフトウェアの規定の共通の理解を持っているユーザーとソフトウェア開発者を有効にすることです。ハードウェア、機能、パフォーマンス、入力と出力、インタフェース要件、警告情報、秘密のセキュリティ、データやデータベース、ドキュメント、および規制を含みます。

3.4ソフトウェア設計

        ソフトウェア設計は、ソフトウェアの要求仕様からのものである、ニーズ分析フェーズ機能の全体的な構造を決定し、システムのソフトウェア設計が機能モジュールに分割され、アルゴリズムは各モジュール、ソフトウェア設計の特定の形態の書き込み特定コードに決定します。

3.5ソフトウェア設計ドキュメント

ソフトウェア設計書は、「アウトライン設計」と「詳細設計」に分かれています

デザイン概要:分割システムモジュール、ネットワークトポロジ、ユースケース図

詳細設計:クラス図、シーケンス図、クラスの在庫、在庫メソッド、インターフェイスリスト、テーブル構造のドキュメント

3.6 UML言語

        UMLは、UMLがあるため、動的および静的な情報を表現するためのシンプルな、統一された機能、およびソフトウェア設計のため、業界標準の視覚的なモデリング言語となっている、標準化されたオブジェクト指向ソフトウェアモデリング言語です。

        UML異なる開始システムの観点から、我々は、ユースケース図、クラス図、オブジェクト図、状態図、アクティビティ図、シーケンス図、コラボレーション図、図部材、図の展開図の9種類を定義します。これらの図は、異なる側面からシステムを記載しています。これらの異なるモデルシステムは、システムの分析と構築のため、コヒーレント全側面に組み込ま。UMLや他の開発ツールは、ビューの多くを引き出すように設計されますが、これらのマップやその他の書類は、開発者が見最も基本的な構成のソフトウェアですが。

4.ビルドMavenプロジェクト

4.1新しい親親プロジェクト

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>
  <groupId>cn.itcast</groupId>
  <artifactId>erp_parent</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <!-- 子工程依赖,后面添加的依赖 -->
  <modules>
  	<module>erp_entity</module>
  	<module>erp_dao</module>
  	<module>erp_biz</module>
  	<module>erp_web</module>
  </modules>
  
   <!-- 定义版本常量 -->
   <properties>
  	<spring.version>4.3.8.RELEASE</spring.version>
  </properties>
  
  <dependencies>
  	 <!-- Spring相关包 -->
     <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-core</artifactId>
         <version>${spring.version}</version>
     </dependency>
     <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-aop</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>
         <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-tx</artifactId>
         <version>${spring.version}</version>
     </dependency>
     <!-- AOP相关包 -->
     <dependency>
         <groupId>org.aspectj</groupId>
         <artifactId>aspectjrt</artifactId>
         <version>1.8.0</version>
     </dependency>
     <dependency>
         <groupId>org.aspectj</groupId>
         <artifactId>aspectjweaver</artifactId>
         <version>1.8.0</version>
     </dependency>
     <!-- 文件上传包  -->
     <dependency>  
         <groupId>commons-fileupload</groupId>  
         <artifactId>commons-fileupload</artifactId>  
         <version>1.3.1</version>  
	 </dependency>

     <!-- MyBatis相关包 -->
     <dependency>
         <groupId>org.mybatis</groupId>
         <artifactId>mybatis</artifactId>
         <version>3.2.7</version>
     </dependency>
     <!-- Spring集成MyBatis -->
     <dependency>
         <groupId>org.mybatis</groupId>
         <artifactId>mybatis-spring</artifactId>
         <version>1.2.3</version>
     </dependency>
     <!-- oracle -->
	 <dependency>
		<groupId>com.oracle</groupId>
		<artifactId>ojdbc6</artifactId>
		<version>11.2.0</version>
	 </dependency>
     <!-- 数据库连接池 -->
     <dependency>
		<groupId>c3p0</groupId>
		<artifactId>c3p0</artifactId>
		<version>0.9.1.2</version>
	 </dependency>

     <!-- JSP标准标签库 -->
     <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>jstl</artifactId>
         <version>1.2</version>
     </dependency>

     <!-- 日志相关包 -->
      <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.17</version>
      </dependency>
      <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
          <version>1.7.5</version>
      </dependency>
      <dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-log4j12</artifactId>
		<version>1.7.5</version>
	  </dependency>
        
       <!-- Junit测试包 -->
       <dependency>
	    	<groupId>org.springframework</groupId>
	    	<artifactId>spring-test</artifactId>
	    	<version>${spring.version}</version>
	   </dependency>
		
	  <!-- json包 -->
	  <dependency>
	      <groupId>com.fasterxml.jackson.core</groupId>
	      <artifactId>jackson-core</artifactId>
	      <version>2.5.4</version>
	    </dependency>
	    <dependency>
	      <groupId>com.fasterxml.jackson.core</groupId>
	      <artifactId>jackson-databind</artifactId>
	      <version>2.5.4</version>
	    </dependency>
 	</dependencies>
  
  	<!-- 版本锁定  -->
    <dependencyManagement>
		<dependencies>
			<dependency>
		  		<groupId>junit</groupId>
		  		<artifactId>junit</artifactId>
		  		<version>4.9</version>
		  		<scope>test</scope>
	  		</dependency>
		</dependencies>
    </dependencyManagement>
    
    <!-- 插件 -->
    <build>
    	<plugins>
    		<plugin>
    			<groupId>org.apache.tomcat.maven</groupId>
    			<artifactId>tomcat7-maven-plugin</artifactId>
    			<version>2.2</version>
    			<configuration>
    				<port>8080</port>
    				<path>/erp</path>
                    <!-- 解决传输数据乱码 -->
    				<uriEncoding>utf-8</uriEncoding>
    			</configuration>
    		</plugin>
    		<plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                     <source>1.7</source>
                     <target>1.7</target>
              </configuration>
       </plugin>
    	</plugins>
    </build>
  
</project>

4.2新しいエンティティのサブプロジェクト

4.3新しい永続層のサブプロジェクト

4.3.1 DAO層のJavaコード

SRC /メイン/ Javaパッケージ名と新しいインターフェイスで

例えば:

4.3.2マッパーの設定ファイル

私たちは、その後、新しいプロファイルプロファイルは、一人であり、次のリソース、ディレクトリ内のパッケージ名と同じDAOのJavaコードで新しいレイヤーを左に管理するためにここにいます

4.3.3 MyBatisのコア・コンフィギュレーション・ファイル

mybatisConfig.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    
</configuration>

春プロファイル4.3.4 DAO層

applicationContext_dao.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context 
		http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/tx 
		http://www.springframework.org/schema/tx/spring-tx.xsd
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop.xsd
		">  
	<!-- 自动扫描 -->  
    <context:component-scan base-package="cn.bjc.mapper"/>

    <!-- 定义数据源Bean -->
   <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/>
		<property name="jdbcUrl" value="jdbc:oracle:thin:@127.0.0.1:1521:ORCL"/>
		<property name="user" value="zoudm"/>
		<property name="password" value="123456"/>
	</bean>
	
	<!-- 加载mybatis核心配置文件 -->
	<bean class="org.mybatis.spring.SqlSessionFactoryBean" id="sqlSessionFactory">
		<!-- 数据源 -->
		<property name="dataSource" ref="dataSource"></property>
		<!-- 核心配置文件 -->
		<property name="configLocation" value="classpath:mybatisConfig.xml"></property>
		<!-- 配置别名包扫描  name为typeAliasesPackage  value为pojo的包名-->
		<property name="typeAliasesPackage" value="cn.bjc.entity"></property>
	</bean>
    
    <!-- DAO接口所在包名,Spring会自动查找其下的类 -->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
 		<property name="basePackage" value="cn.bjc.mapper" />
 	</bean>
</beans>

4.3.5 log4jの設定ファイル

log4j.properties

### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.err
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' ###
# error warn info debug trace
log4j.rootLogger= info, stdout

4.3.6 DAO層のテストコード

テストパッケージで新しいテストクラス



import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import cn.bjc.entity.Dep;
import cn.bjc.mapper.DepMapper;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext_dao.xml")
public class TestDemo1 {
	
	@Autowired
	private DepMapper depMapper;
	
	@Test
	public void test01(){
		List<Dep> all = depMapper.getAll();
		System.out.println(all.toString());
	}
}

4.4ビジネス層のサブプロジェクト

4.4.1プロフィール

applicationContext_biz.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context 
		http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/tx 
		http://www.springframework.org/schema/tx/spring-tx.xsd
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop.xsd
		">  

	<context:component-scan base-package="cn.bjc.biz"/>
	<!-- <bean id="depBiz" class="cn.bjc.biz.impl.DepBiz"></bean> -->
	
</beans>
	

applicationContext_tx.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context 
		http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/tx 
		http://www.springframework.org/schema/tx/spring-tx.xsd
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop.xsd
		">  
	
	
	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" /> 
	</bean>
	
	<tx:advice id="advice" transaction-manager="transactionManager">
	    <tx:attributes>	     
	      <tx:method name="do*" propagation="REQUIRED"/>
	      <tx:method name="add*" propagation="REQUIRED"/>
	      <tx:method name="update*" propagation="REQUIRED"/>
	      <tx:method name="save*" propagation="REQUIRED"/>
	      <tx:method name="delete*" propagation="REQUIRED"/>
	      <tx:method name="*" read-only="true"/>
	    </tx:attributes>
	</tx:advice>
	
	<aop:config>
		<aop:pointcut id="serviceMethod" expression="execution(* cn.bjc.biz.impl.*.*(..))"/>
		<aop:advisor pointcut-ref="serviceMethod" advice-ref="advice" />
	</aop:config>
	
</beans>
	

4.4.2テストクラス

package cn.bjc.test;

import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import cn.bjc.biz.IDepBiz;
import cn.bjc.entity.Dep;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath*:applicationContext*.xml")
public class TestDemo1 {
	
	@Autowired
	private IDepBiz depBiz;
	
	@Test
	public void test01(){
		List<Dep> all = depBiz.getAll();
		System.out.println(all.toString());
	}
}

4.5ウェブ層

4.5.1コントローラコード

DepController.java

package erp.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.bjc.biz.IDepBiz;
import cn.bjc.entity.Dep;

@RestController
@RequestMapping("/dep")
public class DepController {
	
	@Autowired
	private IDepBiz depBiz;
	
	@RequestMapping("/getAll")
	public List<Dep> getAll(){
		List<Dep> all = depBiz.getAll();
		return all;
	}
	
}

4.5.2プロフィール

applicationContext_action.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context 
		http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/tx 
		http://www.springframework.org/schema/tx/spring-tx.xsd
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop.xsd
		">  
	
	<context:component-scan base-package="erp.web.controller"></context:component-scan>
	
</beans>
	

springMvc.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <!-- 启动自动扫描 -->
    <context:component-scan base-package="erp.web.controller" />

    <!-- 注册MVC注解驱动 -->
    <mvc:annotation-driven />

    <!-- 静态资源可访问的设置方式 -->
    <mvc:default-servlet-handler />

    <!-- 配置视图解析器,可以显式设置,也可以不设置,不设置会依据SpringMVC的默认设置 -->
    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/" />
        <property name="suffix" value=".jsp" />
    </bean>
    
    <!-- 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 -->  
    <bean id="multipartResolver"    
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">    
        <!-- 默认编码 -->  
        <property name="defaultEncoding" value="utf-8" />    
        <!-- 文件大小最大值 -->  
        <property name="maxUploadSize" value="10485760000" />    
        <!-- 内存中的最大值 -->  
        <property name="maxInMemorySize" value="40960" />    
    </bean>   
    
</beans>

4.5.3 web.xml構成

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"  
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"  
    version="3.0">  
    <display-name>Archetype Created Web Application</display-name>  
    <!-- Spring和mybatis的配置文件 -->  
    <context-param>  
        <param-name>contextConfigLocation</param-name>  
        <param-value>classpath*:applicationContext*.xml</param-value>  
    </context-param>  
    <!-- 编码过滤器 -->  
    <filter>  
        <filter-name>encodingFilter</filter-name>  
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>  
        <async-supported>true</async-supported>  
        <init-param>  
            <param-name>encoding</param-name>  
            <param-value>UTF-8</param-value>  
        </init-param>  
    </filter>  
    <filter-mapping>  
        <filter-name>encodingFilter</filter-name>  
        <url-pattern>/*</url-pattern>  
    </filter-mapping>  
    <!-- Spring监听器 -->  
    <listener>  
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  
    </listener>  
    <!-- 防止Spring内存溢出监听器 -->  
    <listener>  
        <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>  
    </listener>  
  
    <!-- Spring MVC servlet -->  
    <servlet>  
        <servlet-name>SpringMVC</servlet-name>  
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  
        <init-param>  
            <param-name>contextConfigLocation</param-name>  
            <param-value>
            	classpath:springMvc.xml
            </param-value>  
        </init-param>  
        <load-on-startup>1</load-on-startup>  
        <async-supported>true</async-supported>  
    </servlet>  
    <servlet-mapping>  
        <servlet-name>SpringMVC</servlet-name>  
        <!-- 此处可以可以配置成*.do,对应struts的后缀习惯 -->  
        <url-pattern>/</url-pattern>  
    </servlet-mapping>  
    <welcome-file-list>  
        <welcome-file>/index.jsp</welcome-file>  
    </welcome-file-list>  
  
</web-app> 

注:クラスパスの設定ファイルは、ここでは、ワイルドカードクラスパスを使用する必要があります*

5. 运行

1. 刷新项目

鼠标右键erp_parent——maven——update project,勾选erp项目,点击OK

2. clear项目

鼠标右键erp_parent——run as ——Maven clean,提示Builder success,表示执行成功

3. 运行

鼠标右键erp_parent——run as——Maven Builder(第二个),在Goals的输入框中输入命令:tomcat7:run

4. 访问

复制控制台的url连接

粘贴到浏览器,并带上访问路径

发布了128 篇原创文章 · 获赞 6 · 访问量 3235

おすすめ

転載: blog.csdn.net/weixin_43318134/article/details/103396144
おすすめ