1. 概念 15
互联网金融(ITFIN)是指传统金融机构与互联网企业利用互联网技术和信息通信技术实现资金融通、支付、投资和信息中介服务的新型金融业务模式。
互联网金融ITFIN不是互联网和金融业的简单结合,而是在实现安全、移动等网络技术水平上,被用户熟悉接受后(尤其是对电子商务的接受),自然而然为适应新的需求而产生的新模式及新业务。是传统金融行业与互联网技术相结合的新兴领域。2016年10月13日,国务院办公厅发布《互联网金融风险专项整治工作实施方案的通知》
2. 定义
互联网金融(ITFIN)就是互联网技术和金融功能的有机结合,依托大数据和云计算在开放的互联网平台上形成的功能化金融业态及其服务体系,包括基于网络平台的金融市场体系、金融服务体系、金融组织体系、金融产品体系以及互联网金融监管体系等,并具有普惠金融、平台金融、信息金融和碎片金融等相异于传统金融的金融模式。
3. 业务模式
4. 互联网金融--盈利宝
4.1 盈利宝理财平台
理财端用户提供资金,购买理财产品,获取收益等业务。理财端展现方式:PC电脑、H5页面、APP应用
4.2 项目基本开发流程
1) 公司领导层做出决策;
2) 产品经理根据领导决策勾勒产品需求原型;
3) 产品+设计+技术+测试 需求评审讨论;
4) 评审讨论调整后进入设计阶段,视觉设计+页面设计
5) 技术团队技术架构+技术选型+存储+服务器+运维等
4.3 动力金融网技术选型及开发工具 16
前端:Vue、 Axios, Css , Html ,JavaScript
后端:SpringBoot 、 Dubbo 、MyBatis、MySQL、Redis、Zookeeper
相关组件:HttpClient、Apache commons、HiKariCP、Spring-data-redis
服务器端:Redis、Zookeeper、MySQL、Nginx
项目依赖管理:Maven
项目开发工具:IDEA、Postman, Firefox、EditPlus
4.4 项目结构
5. 项目数据库设计 17
5.1 数据库表设计
5.1 新建数据库 17
5.2 运行sql文件
我放在了E:\java学习\盈利宝\资料\资料\02-数据库SQL
6. 搭建项目结构 18
6.1 新建项目
6.2 准备逆向工程 18
逆向工程设置在course中的ready-04-mapper中了
6.2.1 添加插件
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>com.bjpowernode</groupId>
<artifactId>ready-04-mapper</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<!--mysql驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--mybatis代码自动生成插件 18-->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.6</version>
<configuration>
<!--配置文件的位置-->
<configurationFile>GeneratorMapper.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
6.2.2 拷贝文件
E:\java学习\盈利宝\资料\资料\05-mybatis逆向工程
将GeneratorMapper.xml拷贝到项目根目录下
注释掉
GeneratorMapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 指定连接数据库的JDBC驱动包所在位置,指定到你本机的完整路径 -->
<!-- <classPathEntry location="E:\mysql-connector-java-5.1.38.jar"/>-->
<!-- 配置table表信息内容体,targetRuntime指定采用MyBatis3的版本 -->
<context id="tables" targetRuntime="MyBatis3">
<!-- 抑制生成注释,由于生成的注释都是英文的,可以不让它生成 -->
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!-- 配置数据库连接信息 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/ylb"
userId="root"
password="lzl">
</jdbcConnection>
<!-- 生成model类,targetPackage指定model类的包名, targetProject指定生成的model放在eclipse的哪个工程下面-->
<javaModelGenerator targetPackage="com.bjpowernode.api.model"
targetProject="E:\java学习\盈利宝\course_pre\ready-04-mapper\src\main\java">
<property name="enableSubPackages" value="false" />
<property name="trimStrings" value="false" />
</javaModelGenerator>
<!-- 生成MyBatis的Mapper.xml文件,targetPackage指定mapper.xml文件的包名, targetProject指定生成的mapper.xml放在eclipse的哪个工程下面 -->
<sqlMapGenerator targetPackage="mappers" targetProject="E:\java学习\盈利宝\course_pre\ready-04-mapper\src\main\resources">
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- 生成MyBatis的Mapper接口类文件,targetPackage指定Mapper接口类的包名, targetProject指定生成的Mapper接口放在eclipse的哪个工程下面 -->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.bjpowernode.dataservice.mapper" targetProject="E:\java学习\盈利宝\course_pre\ready-04-mapper\src\main\java">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- 数据库表名及对应的Java模型类名 -->
<table tableName="b_product_info" domainObjectName="ProductInfo"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="b_bid_info" domainObjectName="BidInfo"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="b_income_record" domainObjectName="IncomeRecord"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="b_recharge_record" domainObjectName="RechargeRecord"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="u_user" domainObjectName="User"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="u_finance_account" domainObjectName="FinanceAccount"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"/>
</context>
</generatorConfiguration>
6.2.3 执行
成功
6.3 创建父工程 19
父项目micr-parent
6.4 创建子项目 19
公共项目micr-api
数据服务项目micr-dataservice
在pom.xml文件中一如micr-api得依赖
6.5 分配ready-04-mapper得包 19
给micr-api分配实体类 19
将其中的com拷贝到micr-api目录下即E:\java学习\盈利宝\course\micr-api\src\main\java
删除没用的
最终效果如下
给mict-dataservice分配mapper接口和对应的xml文件 19
到ready-04-mapper拷贝mapper到mict-dataservice即E:\java学习\盈利宝\course\micr-dataservice\src\main\java\com\bjpowernode\dataservice
最终效果
6.6 搭建多模块的环境 21
micr-parent
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>
<!-- 导入springboot得父项目 21-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/>
</parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<!--聚合 19-->
<modules>
<module>../micr-api</module>
<module>../micr-dataservice</module>
</modules>
<!-- 指定版本号 21-->
<properties>
<dubbo.version>2.7.8</dubbo.version>
<zookeeper.version>2.7.8</zookeeper.version>
<mybatis.version>2.2.2</mybatis.version>
<fastjson>1.2.51</fastjson>
<swagger.version>2.9.2</swagger.version>
<swagger.ui.version>1.9.6</swagger.ui.version>
</properties>
<!--管理依赖 21-->
<dependencyManagement>
<dependencies>
<!--声明项目使用的gav-->
<!--Dubbo-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>${dubbo.version}</version>
</dependency>
<!--Zookeeper-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<version>${zookeeper.version}</version>
<type>pom</type>
<exclusions>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!--MyBatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!--Fastjson-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson}</version>
</dependency>
<!--Swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>${swagger.ui.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<!--统一jdk 21-->
<build>
<plugins>
<!-- 编译插件 -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- 插件的版本 -->
<version>3.5.1</version>
<!-- 编译级别 -->
<configuration>
<source>1.8</source>
<target>1.8</target>
<!-- 编码格式 -->
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
micr-dataservice
这个模块充当提供者
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- 将micr-parent的坐标替换到此 22-->
<parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-parent</artifactId>
<version>1.0.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-dataservice</artifactId>
<version>1.0.0</version>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- dubbo公共项目得依赖 19-->
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
看看依赖
7. 配置文件 22
micr-dataservice模块
application.yml 22
#服务名称 22
spring:
application:
name: micr-dataservice
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ylb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
username: root
password: lzl
#设置mybatis 22
mybatis:
mapper-locations: classpath:/mappers/**/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #配置日志 22
map-underscore-to-camel-case: true #配置驼峰命名 22
启动类 22
package com.bjpowernode.dataservice;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//启动类
@MapperScan(basePackages = "com.bjpowernode.dataservice.mapper") //扫描mapper包 22
@SpringBootApplication
public class MicrDataserviceApplication {
public static void main(String[] args) {
SpringApplication.run(MicrDataserviceApplication.class, args);
}
}
启动,没有报错,成功
继续在pom.xml 中添加依赖 23
<!--dubbo起步依赖 23-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<!-- zookeeper依赖 23-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<type>pom</type>
</dependency>
application.yml 23
#Dubbo配置 23
dubbo:
registry:
address: zookeeper://localhost:2181
scan:
base-packages: com.bjpowernode.dataservice.service #提供者实现类 23
provider:
timeout: 50000
retries: 0
在启动类添加注解EnableDubbo
测试一下 23
先启动zookeeper
E:\java\tools\apache-zookeeper-3.5.5-bin\bin
在启动后端,成功
给服务提供者改个名
8. 添加micr-web模块 24
这个模块充当消费者
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- 自己的父项目将micr-parent的坐标替换到此 22-->
<parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-parent</artifactId>
<version>1.0.0</version>
<relativePath/>
</parent>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-web</artifactId>
<version>1.0.0</version>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--dubbo公共项目得依赖 19-->
<dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>micr-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--dubbo起步依赖 23-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<!-- zookeeper依赖 23-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<type>pom</type>
</dependency>
<!--Swagger 24-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
在父项目中添加聚合
配置application.yml
spring:
application:
name: micr-web
mvc:
pathmatch:
matching-strategy: ant_path_matcher
#端口号 24
server:
port: 8000
servlet:
context-path: /api
encoding: #配置监听器
enabled: true
charset: utf-8
force: true
#dubbo配置
dubbo:
registry:
address: zookeeper://localhost:2181
scan:
base-packages: com.bjpowernode.front
consumer:
check: false
timeout: 50000
retries: 0
启动类
package com.bjpowernode.front;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//启动类
@EnableDubbo //启动dubbo 24
@SpringBootApplication
public class MicrWebApplication {
public static void main(String[] args) {
SpringApplication.run(MicrWebApplication.class, args);
}
}
改个名
测试启动
先启动zookeeper
在启动后端,成功
至此项目的配置和环境搭建完毕!
标签:dubbo,项目,spring,boot,micr,概述,org,com,搭建 From: https://blog.51cto.com/u_15784725/6959599