Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚本章
dm_project
Commits
d22a126f
Commit
d22a126f
authored
Dec 03, 2020
by
zhangc
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm_dev' of gitlab.ioubuy.cn:yaobenzhang/dm_project into dm_dev
parents
05951075
e44ed819
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
927 additions
and
393 deletions
+927
-393
BaseController.java
...mmon/src/main/java/com/jz/common/base/BaseController.java
+1
-0
CurrentUser.java
...-common/src/main/java/com/jz/common/base/CurrentUser.java
+44
-0
MallCustomerApiDto.java
.../src/main/java/com/jz/common/bean/MallCustomerApiDto.java
+84
-0
RedisMessageConstant.java
...ain/java/com/jz/common/constant/RedisMessageConstant.java
+2
-0
UserTypeEnum.java
...ommon/src/main/java/com/jz/common/enums/UserTypeEnum.java
+36
-0
SessionUtils.java
...ommon/src/main/java/com/jz/common/utils/SessionUtils.java
+5
-11
pom.xml
jz-dm-mall/pom.xml
+2
-2
DatabaseConfig.java
...l/src/main/java/com/jz/dm/mall/config/DatabaseConfig.java
+254
-254
LoginController.java
...z/dm/mall/moduls/controller/customer/LoginController.java
+8
-10
MallCustomerController.java
...ll/moduls/controller/customer/MallCustomerController.java
+28
-0
ValidateCodeController.java
...ll/moduls/controller/customer/ValidateCodeController.java
+91
-81
FinanceTradeFlowController.java
...moduls/controller/finance/FinanceTradeFlowController.java
+14
-4
FinanceCustomerAssetsDto.java
...uls/controller/finance/bean/FinanceCustomerAssetsDto.java
+88
-0
FinanceTradeFlowDao.java
...ava/com/jz/dm/mall/moduls/mapper/FinanceTradeFlowDao.java
+4
-0
MallCustomerDao.java
...in/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
+6
-0
FinanceTradeFlowService.java
...om/jz/dm/mall/moduls/service/FinanceTradeFlowService.java
+5
-0
MallCustomerService.java
...va/com/jz/dm/mall/moduls/service/MallCustomerService.java
+8
-3
FinanceTradeFlowServiceImpl.java
...mall/moduls/service/impl/FinanceTradeFlowServiceImpl.java
+9
-1
MallCustomerServiceImpl.java
.../dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
+73
-4
FinanceCustomerAssetsDao.xml
...rc/main/resources/mapperconf/FinanceCustomerAssetsDao.xml
+12
-12
FinanceTradeFlowDao.xml
...all/src/main/resources/mapperconf/FinanceTradeFlowDao.xml
+20
-0
LoginController.java
.../com/jz/manage/moduls/controller/sys/LoginController.java
+2
-6
SysUserDto.java
.../com/jz/manage/moduls/controller/sys/bean/SysUserDto.java
+89
-0
SysUserServiceImpl.java
...com/jz/manage/moduls/service/impl/SysUserServiceImpl.java
+42
-5
No files found.
jz-dm-common/src/main/java/com/jz/common/base/BaseController.java
View file @
d22a126f
...
...
@@ -10,4 +10,5 @@ public class BaseController {
public Integer getCurrentUserId(){
return getCurrentUser().getUserId();
}*/
}
jz-dm-common/src/main/java/com/jz/common/base/CurrentUser.java
0 → 100644
View file @
d22a126f
package
com
.
jz
.
common
.
base
;
import
com.jz.common.bean.MallCustomerApiDto
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/3
* @Version:
*/
public
class
CurrentUser
{
/**
* 获取用户信息
* @param req
* @return
*/
public
static
MallCustomerApiDto
getCurrentUser
(
HttpServletRequest
req
){
MallCustomerApiDto
mallCustomerApiDto
=(
MallCustomerApiDto
)
req
.
getAttribute
(
"mallCustomer"
);
return
mallCustomerApiDto
;
}
/**
* 用户id
* @param request
* @return
*/
public
static
Long
getCustomerId
(
HttpServletRequest
request
)
{
Long
customerId
=
getCurrentUser
(
request
).
getCustomerId
();
return
customerId
;
}
/**
* 企业id
* @param request
* @return
*/
public
static
Long
getDepartmentId
(
HttpServletRequest
request
)
{
Long
departmentId
=
getCurrentUser
(
request
).
getDepartmentId
();
return
departmentId
;
}
}
jz-dm-common/src/main/java/com/jz/common/bean/MallCustomerApiDto.java
0 → 100644
View file @
d22a126f
package
com
.
jz
.
common
.
bean
;
import
com.jz.common.enums.UserTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
/**
* @ClassName: 商城用户状态信息
* @Author: Carl
* @Date: 2020/12/3
* @Version:
*/
@ApiModel
public
class
MallCustomerApiDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
8769496459018372044L
;
@ApiModelProperty
(
value
=
"用户id"
)
private
Long
customerId
;
@ApiModelProperty
(
value
=
"用户类型"
)
private
UserTypeEnum
userTypeEnum
;
@ApiModelProperty
(
value
=
"企业id"
)
private
Long
departmentId
;
/**
* 账户
*/
@ApiModelProperty
(
value
=
"账户"
)
private
String
customerAccount
;
/**
* 用户真实姓名
*/
@ApiModelProperty
(
value
=
"用户真实姓名"
)
private
String
customerName
;
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
public
Long
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
Long
customerId
)
{
this
.
customerId
=
customerId
;
}
public
UserTypeEnum
getUserTypeEnum
()
{
return
userTypeEnum
;
}
public
void
setUserTypeEnum
(
UserTypeEnum
userTypeEnum
)
{
this
.
userTypeEnum
=
userTypeEnum
;
}
public
Long
getDepartmentId
()
{
return
departmentId
;
}
public
void
setDepartmentId
(
Long
departmentId
)
{
this
.
departmentId
=
departmentId
;
}
public
String
getCustomerAccount
()
{
return
customerAccount
;
}
public
void
setCustomerAccount
(
String
customerAccount
)
{
this
.
customerAccount
=
customerAccount
;
}
public
String
getCustomerName
()
{
return
customerName
;
}
public
void
setCustomerName
(
String
customerName
)
{
this
.
customerName
=
customerName
;
}
}
jz-dm-common/src/main/java/com/jz/common/constant/RedisMessageConstant.java
View file @
d22a126f
...
...
@@ -3,4 +3,6 @@ package com.jz.common.constant;
public
interface
RedisMessageConstant
{
static
final
String
SENDTYPE_GETPWD
=
"001"
;
//用于缓存找回密码时发送的验证码
static
final
String
SENDTYPE_LOGIN
=
"002"
;
// 用于缓存注册用户时发送的验证码
static
final
String
SENDTYPE_LOGIN_CUSTOMER
=
"003"
;
static
final
String
SENDTYPE_LOGIN_SYS
=
"004"
;
}
\ No newline at end of file
jz-dm-common/src/main/java/com/jz/common/enums/UserTypeEnum.java
0 → 100644
View file @
d22a126f
package
com
.
jz
.
common
.
enums
;
/**
* @Author: Carl
* @Date: 2020/12/3
* @Version:
*/
public
enum
UserTypeEnum
{
COMPANY_ROLE
(
"商城的id"
,
"1"
),
BACKGROUND_ROLE
(
"企业的id"
,
"2"
),
;
private
String
code
;
private
String
value
;
private
UserTypeEnum
(
String
code
,
String
value
)
{
this
.
code
=
code
;
this
.
value
=
value
;
}
public
String
getCode
()
{
return
code
;
}
public
String
getValue
()
{
return
value
;
}
}
jz-dm-common/src/main/java/com/jz/common/utils/SessionUtils.java
View file @
d22a126f
package
com
.
jz
.
common
.
utils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
/**
...
...
@@ -19,19 +16,16 @@ public class SessionUtils {
* @param objName 存储到session中的对象的变量名
* @param o 存储的任意数据
*/
public
static
void
push
(
String
objName
,
Object
o
)
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
public
static
void
setUserCurrent
(
String
objName
,
Object
o
,
HttpServletRequest
request
)
{
request
.
getSession
().
setAttribute
(
objName
,
o
);
}
/**
* 从session中获取数据
* @param
objName
存储到session中的对象的变量名
* @param
key
存储到session中的对象的变量名
*/
public
static
Object
pop
(
String
objName
)
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
return
request
.
getSession
().
getAttribute
(
objName
);
public
static
Object
getUserCurrent
(
HttpServletRequest
request
,
String
key
){
return
request
.
getSession
().
getAttribute
(
key
);
}
}
jz-dm-mall/pom.xml
View file @
d22a126f
...
...
@@ -74,10 +74,10 @@
</dependency>
<!-- spring boot 和mybatis -->
<
!--<
dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
</dependency>
-->
</dependency>
<!-- mybatis plus -->
<dependency>
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/config/DatabaseConfig.java
View file @
d22a126f
//package com.jz.dm.mall.config;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import javax.sql.DataSource;
//import java.sql.SQLException;
//
///**
// * @ProjectName zhaxinle
// * @Author: zeroJun
// * @Date: 2018/8/16 16:49
// * @Description: 主数据源配置类
// */
//@Configuration
//// 前缀为primary.datasource.druid的配置信息
//@ConfigurationProperties(prefix = "spring.datasource")
//@MapperScan(basePackages = DatabaseConfig.PACKAGE, sqlSessionFactoryRef = "sqlSessionFactory")
//public class DatabaseConfig {
//
// /**
// * dao层的包路径
// */
// static final String PACKAGE = "com.jz.dm.mall.moduls.mapper";
//
// /**
// * mapper文件的相对路径
// */
// private static final String MAPPER_LOCATION = "classpath:mapperconf/*.xml";
//
// private String filters;
// private String url;
// private String username;
// private String password;
// private String driverClassName;
// private int initialSize;
// private int minIdle;
// private int maxActive;
// private long maxWait;
// private long timeBetweenEvictionRunsMillis;
// private long minEvictableIdleTimeMillis;
// private String validationQuery;
// private boolean testWhileIdle;
// private boolean testOnBorrow;
// private boolean testOnReturn;
// private boolean poolPreparedStatements;
// private int maxPoolPreparedStatementPerConnectionSize;
//
// // 主数据源使用@Primary注解进行标识
// //@Primary
// @Bean(name = "dataSource")
// public DataSource dataSource() throws SQLException {
// DruidDataSource druid = new DruidDataSource();
// // 监控统计拦截的filters
// druid.setFilters(filters);
//
// // 配置基本属性
// druid.setDriverClassName(driverClassName);
// druid.setUsername(username);
// druid.setPassword(password);
// druid.setUrl(url);
//
// //初始化时建立物理连接的个数
// druid.setInitialSize(initialSize);
// //最大连接池数量
// druid.setMaxActive(maxActive);
// //最小连接池数量
// druid.setMinIdle(minIdle);
// //获取连接时最大等待时间,单位毫秒。
// druid.setMaxWait(maxWait);
// //间隔多久进行一次检测,检测需要关闭的空闲连接
// druid.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
// //一个连接在池中最小生存的时间
// druid.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
// //用来检测连接是否有效的sql
// druid.setValidationQuery(validationQuery);
// //建议配置为true,不影响性能,并且保证安全性。
// druid.setTestWhileIdle(testWhileIdle);
// //申请连接时执行validationQuery检测连接是否有效
// druid.setTestOnBorrow(testOnBorrow);
// druid.setTestOnReturn(testOnReturn);
// //是否缓存preparedStatement,也就是PSCache,oracle设为true,mysql设为false。分库分表较多推荐设置为false
// druid.setPoolPreparedStatements(poolPreparedStatements);
// // 打开PSCache时,指定每个连接上PSCache的大小
// druid.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
//
// return druid;
// }
//
// // 创建该数据源的事务管理
// @Primary
// @Bean(name = "transactionManager")
// public DataSourceTransactionManager transactionManager() throws SQLException {
// return new DataSourceTransactionManager(dataSource());
// }
//
// // 创建Mybatis的连接会话工厂实例
// @Primary
// @Bean(name = "sqlSessionFactory")
// public SqlSessionFactory sqlSessionFactory(@Qualifier("dataSource") DataSource dataSource) throws Exception {
// final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
// sessionFactory.setDataSource(dataSource); // 设置数据源bean
// sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
// .getResources(DatabaseConfig.MAPPER_LOCATION)); // 设置mapper文件路径
//
// return sessionFactory.getObject();
// }
//
// public String getFilters() {
// return filters;
// }
//
// public void setFilters(String filters) {
// this.filters = filters;
// }
//
// public String getUrl() {
// return url;
// }
//
// public void setUrl(String url) {
// this.url = url;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public String getDriverClassName() {
// return driverClassName;
// }
//
// public void setDriverClassName(String driverClassName) {
// this.driverClassName = driverClassName;
// }
//
// public int getInitialSize() {
// return initialSize;
// }
//
// public void setInitialSize(int initialSize) {
// this.initialSize = initialSize;
// }
//
// public int getMinIdle() {
// return minIdle;
// }
//
// public void setMinIdle(int minIdle) {
// this.minIdle = minIdle;
// }
//
// public int getMaxActive() {
// return maxActive;
// }
//
// public void setMaxActive(int maxActive) {
// this.maxActive = maxActive;
// }
//
// public long getMaxWait() {
// return maxWait;
// }
//
// public void setMaxWait(long maxWait) {
// this.maxWait = maxWait;
// }
//
// public long getTimeBetweenEvictionRunsMillis() {
// return timeBetweenEvictionRunsMillis;
// }
//
// public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
// this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
// }
//
// public long getMinEvictableIdleTimeMillis() {
// return minEvictableIdleTimeMillis;
// }
//
// public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
// this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
// }
//
// public String getValidationQuery() {
// return validationQuery;
// }
//
// public void setValidationQuery(String validationQuery) {
// this.validationQuery = validationQuery;
// }
//
// public boolean isTestWhileIdle() {
// return testWhileIdle;
// }
//
// public void setTestWhileIdle(boolean testWhileIdle) {
// this.testWhileIdle = testWhileIdle;
// }
//
// public boolean isTestOnBorrow() {
// return testOnBorrow;
// }
//
// public void setTestOnBorrow(boolean testOnBorrow) {
// this.testOnBorrow = testOnBorrow;
// }
//
// public boolean isTestOnReturn() {
// return testOnReturn;
// }
//
// public void setTestOnReturn(boolean testOnReturn) {
// this.testOnReturn = testOnReturn;
// }
//
// public boolean isPoolPreparedStatements() {
// return poolPreparedStatements;
// }
//
// public void setPoolPreparedStatements(boolean poolPreparedStatements) {
// this.poolPreparedStatements = poolPreparedStatements;
// }
//
// public int getMaxPoolPreparedStatementPerConnectionSize() {
// return maxPoolPreparedStatementPerConnectionSize;
// }
//
// public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) {
// this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize;
// }
//
//}
\ No newline at end of file
package
com
.
jz
.
dm
.
mall
.
config
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.mybatis.spring.SqlSessionFactoryBean
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
javax.sql.DataSource
;
import
java.sql.SQLException
;
/**
* @ProjectName zhaxinle
* @Author: zeroJun
* @Date: 2018/8/16 16:49
* @Description: 主数据源配置类
*/
@Configuration
// 前缀为primary.datasource.druid的配置信息
@ConfigurationProperties
(
prefix
=
"spring.datasource"
)
@MapperScan
(
basePackages
=
DatabaseConfig
.
PACKAGE
,
sqlSessionFactoryRef
=
"sqlSessionFactory"
)
public
class
DatabaseConfig
{
/**
* dao层的包路径
*/
static
final
String
PACKAGE
=
"com.jz.dm.mall.moduls.mapper"
;
/**
* mapper文件的相对路径
*/
private
static
final
String
MAPPER_LOCATION
=
"classpath:mapperconf/*.xml"
;
private
String
filters
;
private
String
url
;
private
String
username
;
private
String
password
;
private
String
driverClassName
;
private
int
initialSize
;
private
int
minIdle
;
private
int
maxActive
;
private
long
maxWait
;
private
long
timeBetweenEvictionRunsMillis
;
private
long
minEvictableIdleTimeMillis
;
private
String
validationQuery
;
private
boolean
testWhileIdle
;
private
boolean
testOnBorrow
;
private
boolean
testOnReturn
;
private
boolean
poolPreparedStatements
;
private
int
maxPoolPreparedStatementPerConnectionSize
;
// 主数据源使用@Primary注解进行标识
//@Primary
@Bean
(
name
=
"dataSource"
)
public
DataSource
dataSource
()
throws
SQLException
{
DruidDataSource
druid
=
new
DruidDataSource
();
// 监控统计拦截的filters
druid
.
setFilters
(
filters
);
// 配置基本属性
druid
.
setDriverClassName
(
driverClassName
);
druid
.
setUsername
(
username
);
druid
.
setPassword
(
password
);
druid
.
setUrl
(
url
);
//初始化时建立物理连接的个数
druid
.
setInitialSize
(
initialSize
);
//最大连接池数量
druid
.
setMaxActive
(
maxActive
);
//最小连接池数量
druid
.
setMinIdle
(
minIdle
);
//获取连接时最大等待时间,单位毫秒。
druid
.
setMaxWait
(
maxWait
);
//间隔多久进行一次检测,检测需要关闭的空闲连接
druid
.
setTimeBetweenEvictionRunsMillis
(
timeBetweenEvictionRunsMillis
);
//一个连接在池中最小生存的时间
druid
.
setMinEvictableIdleTimeMillis
(
minEvictableIdleTimeMillis
);
//用来检测连接是否有效的sql
druid
.
setValidationQuery
(
validationQuery
);
//建议配置为true,不影响性能,并且保证安全性。
druid
.
setTestWhileIdle
(
testWhileIdle
);
//申请连接时执行validationQuery检测连接是否有效
druid
.
setTestOnBorrow
(
testOnBorrow
);
druid
.
setTestOnReturn
(
testOnReturn
);
//是否缓存preparedStatement,也就是PSCache,oracle设为true,mysql设为false。分库分表较多推荐设置为false
druid
.
setPoolPreparedStatements
(
poolPreparedStatements
);
// 打开PSCache时,指定每个连接上PSCache的大小
druid
.
setMaxPoolPreparedStatementPerConnectionSize
(
maxPoolPreparedStatementPerConnectionSize
);
return
druid
;
}
// 创建该数据源的事务管理
@Primary
@Bean
(
name
=
"transactionManager"
)
public
DataSourceTransactionManager
transactionManager
()
throws
SQLException
{
return
new
DataSourceTransactionManager
(
dataSource
());
}
// 创建Mybatis的连接会话工厂实例
@Primary
@Bean
(
name
=
"sqlSessionFactory"
)
public
SqlSessionFactory
sqlSessionFactory
(
@Qualifier
(
"dataSource"
)
DataSource
dataSource
)
throws
Exception
{
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
sessionFactory
.
setDataSource
(
dataSource
);
// 设置数据源bean
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
()
.
getResources
(
DatabaseConfig
.
MAPPER_LOCATION
));
// 设置mapper文件路径
return
sessionFactory
.
getObject
();
}
public
String
getFilters
()
{
return
filters
;
}
public
void
setFilters
(
String
filters
)
{
this
.
filters
=
filters
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getDriverClassName
()
{
return
driverClassName
;
}
public
void
setDriverClassName
(
String
driverClassName
)
{
this
.
driverClassName
=
driverClassName
;
}
public
int
getInitialSize
()
{
return
initialSize
;
}
public
void
setInitialSize
(
int
initialSize
)
{
this
.
initialSize
=
initialSize
;
}
public
int
getMinIdle
()
{
return
minIdle
;
}
public
void
setMinIdle
(
int
minIdle
)
{
this
.
minIdle
=
minIdle
;
}
public
int
getMaxActive
()
{
return
maxActive
;
}
public
void
setMaxActive
(
int
maxActive
)
{
this
.
maxActive
=
maxActive
;
}
public
long
getMaxWait
()
{
return
maxWait
;
}
public
void
setMaxWait
(
long
maxWait
)
{
this
.
maxWait
=
maxWait
;
}
public
long
getTimeBetweenEvictionRunsMillis
()
{
return
timeBetweenEvictionRunsMillis
;
}
public
void
setTimeBetweenEvictionRunsMillis
(
long
timeBetweenEvictionRunsMillis
)
{
this
.
timeBetweenEvictionRunsMillis
=
timeBetweenEvictionRunsMillis
;
}
public
long
getMinEvictableIdleTimeMillis
()
{
return
minEvictableIdleTimeMillis
;
}
public
void
setMinEvictableIdleTimeMillis
(
long
minEvictableIdleTimeMillis
)
{
this
.
minEvictableIdleTimeMillis
=
minEvictableIdleTimeMillis
;
}
public
String
getValidationQuery
()
{
return
validationQuery
;
}
public
void
setValidationQuery
(
String
validationQuery
)
{
this
.
validationQuery
=
validationQuery
;
}
public
boolean
isTestWhileIdle
()
{
return
testWhileIdle
;
}
public
void
setTestWhileIdle
(
boolean
testWhileIdle
)
{
this
.
testWhileIdle
=
testWhileIdle
;
}
public
boolean
isTestOnBorrow
()
{
return
testOnBorrow
;
}
public
void
setTestOnBorrow
(
boolean
testOnBorrow
)
{
this
.
testOnBorrow
=
testOnBorrow
;
}
public
boolean
isTestOnReturn
()
{
return
testOnReturn
;
}
public
void
setTestOnReturn
(
boolean
testOnReturn
)
{
this
.
testOnReturn
=
testOnReturn
;
}
public
boolean
isPoolPreparedStatements
()
{
return
poolPreparedStatements
;
}
public
void
setPoolPreparedStatements
(
boolean
poolPreparedStatements
)
{
this
.
poolPreparedStatements
=
poolPreparedStatements
;
}
public
int
getMaxPoolPreparedStatementPerConnectionSize
()
{
return
maxPoolPreparedStatementPerConnectionSize
;
}
public
void
setMaxPoolPreparedStatementPerConnectionSize
(
int
maxPoolPreparedStatementPerConnectionSize
)
{
this
.
maxPoolPreparedStatementPerConnectionSize
=
maxPoolPreparedStatementPerConnectionSize
;
}
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/LoginController.java
View file @
d22a126f
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
;
import
com.jz.common.base.CurrentUser
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.StatusCode
;
...
...
@@ -12,8 +13,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet
.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
org.apache.catalina.servlet4preview
.http.HttpServletRequest
;
/**
* @ClassName:
...
...
@@ -40,27 +41,24 @@ public class LoginController {
* @return
*/
@PostMapping
(
value
=
"/login"
)
public
Result
<
MallCustomer
>
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
{
public
Result
<
MallCustomer
>
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
throws
Exception
{
// 手机
String
ph
=
"^[1][34578]\\d{9}$"
;
HttpSession
session
=
request
.
getSession
();
// 如果是手机验证
if
(
username
.
matches
(
username
))
{
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
username
);
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
username
,
request
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerPhone
().
equals
(
username
)
&&
mallCustomer
.
getPassword
().
equals
(
password
)){
session
.
setAttribute
(
"customer_id"
,
mallCustomer
.
getCustomerId
());
session
.
setAttribute
(
"customer_account"
,
mallCustomer
.
getCustomerAccount
());
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
}
}
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByAccount
(
username
);
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByAccount
(
username
,
request
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerAccount
().
equals
(
username
)
&&
mallCustomer
.
getPassword
().
equals
(
password
)){
session
.
setAttribute
(
"customer_id"
,
mallCustomer
.
getCustomerId
());
session
.
setAttribute
(
"customer_account"
,
mallCustomer
.
getCustomerAccount
(
));
System
.
out
.
println
(
CurrentUser
.
getCurrentUser
(
request
));
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
}
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/MallCustomerController.java
View file @
d22a126f
...
...
@@ -2,6 +2,8 @@ package com.jz.dm.mall.moduls.controller.customer;
import
com.jz.common.base.BaseController
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.StatusCode
;
...
...
@@ -32,6 +34,32 @@ public class MallCustomerController extends BaseController {
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 添加用户
* @param paramMap
* @return
*/
@PostMapping
(
"/saveCustomer"
)
public
Result
saveCustomer
(
@RequestParam
(
required
=
false
)
Map
<
String
,
String
>
paramMap
)
{
if
(
paramMap
!=
null
)
{
String
username
=
paramMap
.
get
(
"username"
);
String
telephone
=
paramMap
.
get
(
"telephone"
);
if
(
username
==
null
)
{
return
new
Result
(
false
,
"请输入用户名!"
);
}
// // 根据用户名查询用户信息
//// MallCustomer mallCustomer = mallCustomerService.selectByAccount(username);
//// if (mallCustomer.getCustomerAccount().equals(username)) {
//// return new Result(false, "用户名相同!");
//// }
//// if (mallCustomer.getCustomerPhone().equals(telephone)) {
//// return new Result(false,"手机号相同!");
//// }
mallCustomerService
.
saveCustomer
(
paramMap
);
return
new
Result
(
true
,
"注册成功!"
,
StatusCode
.
OK
);
}
return
new
Result
(
false
,
"注册失败!"
,
StatusCode
.
ERROR
);
}
/**
* 手机号码校验
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/ValidateCodeController.java
View file @
d22a126f
//package com.jz.dm.mall.moduls.controller.customer;
//
//import com.aliyuncs.exceptions.ClientException;
//import com.jz.common.constant.RedisMessageConstant;
//import com.jz.common.utils.Result;
//import com.jz.common.utils.SMSUtils;
//import com.jz.common.utils.ValidateCodeUtils;
//import io.swagger.annotations.Api;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import redis.clients.jedis.Jedis;
//import redis.clients.jedis.JedisPool;
//
///**
// * @ClassName: 短信发送接口
// * @Author: Carl
// * @Date: 2020/12/2
// * @Version:
// */
//@RestController
//@RequestMapping("/validateCode")
//@Api(tags = "短信发送api")
//public class ValidateCodeController {
//
// //@Autowired
// //private JedisPool jedisPool;
//
// /**
// * 注册时发送的验证码
// * @param telephone
// * @return
// */
// @PostMapping("/send4Login")
// public Result send4Login(String telephone) {
// // 查询redis里是否存在该手机号
// Jedis jedis = jedisPool.getResource();
// String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// String codeInRedis = jedis.get(key);
// if (codeInRedis != null && !codeInRedis.equals("")) {
// // redis中的数据还未过期
// return new Result(false, "验证码已发送,请注意查收!");
// }else {
// Integer code = ValidateCodeUtils.generateValidateCode(6);
// try {
// SMSUtils.sendShortMessage(SMSUtils.VALIDATE_CODE, telephone, code.toString());
// } catch (Exception e) {
// e.printStackTrace();
// }
// jedis.setex(key,5*60,code+"");
// return new Result(true, "验证码发送成功!");
// }
// }
//
// /**
// * 修改密码发送验证码
// * @param telephone
// * @return
// */
// @PostMapping("/send4Code")
// public Result send4Code(String telephone) {
// // 查询redis里是否存在该手机号
// Jedis jedis = jedisPool.getResource();
// String key = RedisMessageConstant.SENDTYPE_GETPWD + "_" + telephone;
// String codeInRedis = jedis.get(key);
// if (codeInRedis != null && !codeInRedis.equals("")) {
// // redis中的数据还未过期
// return new Result(false, "验证码已发送,请注意查收!");
// }else {
// Integer code = ValidateCodeUtils.generateValidateCode(6);
// try {
// SMSUtils.sendShortMessage(SMSUtils.VALIDATE_CODE, telephone, code.toString());
// } catch (Exception e) {
// e.printStackTrace();
// }
// jedis.setex(key,5*60,code+"");
// return new Result(true, "验证码发送成功!");
// }
// }
//}
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.SMSUtils
;
import
com.jz.common.utils.ValidateCodeUtils
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.concurrent.TimeUnit
;
/**
* @ClassName: 短信发送接口
* @Author: Carl
* @Date: 2020/12/2
* @Version:
*/
@RestController
@RequestMapping
(
"/validateCode"
)
@Api
(
tags
=
"短信发送api"
)
public
class
ValidateCodeController
{
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 注册时发送的验证码
* @param telephone
* @return
*/
@PostMapping
(
value
=
"/sendForLogin"
)
public
Result
sendForLogin
(
String
telephone
)
{
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
// 通过手机号从redis获取验证码
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
if
(!
StringUtils
.
isEmpty
(
codeInRedis
))
{
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
);
}
else
{
// 生成验证码
String
code
=
ValidateCodeUtils
.
generateValidateCode
(
6
)
+
""
;
// 发送
try
{
SMSUtils
.
sendShortMessage
(
SMSUtils
.
VALIDATE_CODE
,
telephone
,
code
);
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
return
new
Result
(
false
,
"验证码发送失败!"
);
}
// 存入redis, 有效期为5分钟
redisTemplate
.
opsForValue
().
set
(
key
,
code
,
5
,
TimeUnit
.
MINUTES
);
return
new
Result
(
true
,
"验证码发送成功!"
);
}
}
/**
* 修改密码发送验证码
* @param telephone
* @return
*/
@PostMapping
(
"/send4Code"
)
public
Result
send4Code
(
String
telephone
)
{
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
// 通过手机号从redis获取验证码
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
if
(!
StringUtils
.
isEmpty
(
codeInRedis
))
{
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
);
}
else
{
// 生成验证码
String
code
=
ValidateCodeUtils
.
generateValidateCode
(
6
)
+
""
;
// 发送
try
{
SMSUtils
.
sendShortMessage
(
SMSUtils
.
VALIDATE_CODE
,
telephone
,
code
);
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
return
new
Result
(
false
,
"验证码发送失败!"
);
}
// 存入redis, 有效期为5分钟
redisTemplate
.
opsForValue
().
set
(
key
,
code
,
5
,
TimeUnit
.
MINUTES
);
return
new
Result
(
true
,
"验证码发送成功!"
);
}
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/finance/FinanceTradeFlowController.java
View file @
d22a126f
...
...
@@ -2,7 +2,7 @@ package com.jz.dm.mall.moduls.controller.finance;
import
com.jz.common.base.BaseController
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.
order.bean.Order
Dto
;
import
com.jz.dm.mall.moduls.controller.
finance.bean.FinanceCustomerAssets
Dto
;
import
com.jz.dm.mall.moduls.service.FinanceTradeFlowService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 企业客户交易流水(TFinanceTradeFlow)表控制层
...
...
@@ -33,11 +35,19 @@ public class FinanceTradeFlowController extends BaseController {
* 充值----获取企业账户余额
*
* @author Bellamy
* @since 2020-12-03
*/
@GetMapping
(
value
=
"/getAccountMoney"
)
@ApiOperation
(
value
=
"充值----获取账户余额"
,
notes
=
"获取账户余额"
)
public
Result
<
OrderDto
>
getAccountMoney
(
HttpServletRequest
req
)
throws
Exception
{
return
new
Result
<>();
@ApiOperation
(
value
=
"充值----获取账户余额"
,
notes
=
"获取账户余额,只有已审核(认证)企业才可以充值"
)
public
Result
<
FinanceCustomerAssetsDto
>
getAccountMoney
(
HttpServletRequest
requset
)
throws
Exception
{
Result
<
FinanceCustomerAssetsDto
>
result
=
new
Result
<>();
//requset.getSession().getAttribute(""); //从session中获取商城用户的 id,和企业资产账户id
Map
map
=
new
HashMap
();
map
.
put
(
"assetsId"
,
1
);
//企业资产账户id
map
.
put
(
"departmentId"
,
1
);
//企业ID
FinanceCustomerAssetsDto
dto
=
financeTradeFlowService
.
queryAccountMoneyByMap
(
map
);
result
.
setResult
(
dto
);
return
result
;
}
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/finance/bean/FinanceCustomerAssetsDto.java
0 → 100644
View file @
d22a126f
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
finance
.
bean
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* 商城企业客户资产(TFinanceCustomerAssets)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:38
*/
@ApiModel
public
class
FinanceCustomerAssetsDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
86484762300825431L
;
/**
* 资产id
*/
@TableId
(
value
=
"assets_id"
,
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"资产id"
)
private
Long
assetsId
;
/**
* 企业id
*/
@ApiModelProperty
(
value
=
"企业id"
)
private
Long
departmentId
;
/**
* 可用金额
*/
@ApiModelProperty
(
value
=
"可用金额"
)
private
BigDecimal
useMoney
;
/**
* 冻结金额
*/
@ApiModelProperty
(
value
=
"冻结金额"
)
private
BigDecimal
frozenMoney
;
/**
* 总金额
*/
@ApiModelProperty
(
value
=
"总金额"
)
private
BigDecimal
totalMoney
;
public
Long
getAssetsId
()
{
return
assetsId
;
}
public
void
setAssetsId
(
Long
assetsId
)
{
this
.
assetsId
=
assetsId
;
}
public
Long
getDepartmentId
()
{
return
departmentId
;
}
public
void
setDepartmentId
(
Long
departmentId
)
{
this
.
departmentId
=
departmentId
;
}
public
BigDecimal
getUseMoney
()
{
return
useMoney
;
}
public
void
setUseMoney
(
BigDecimal
useMoney
)
{
this
.
useMoney
=
useMoney
;
}
public
BigDecimal
getFrozenMoney
()
{
return
frozenMoney
;
}
public
void
setFrozenMoney
(
BigDecimal
frozenMoney
)
{
this
.
frozenMoney
=
frozenMoney
;
}
public
BigDecimal
getTotalMoney
()
{
return
totalMoney
;
}
public
void
setTotalMoney
(
BigDecimal
totalMoney
)
{
this
.
totalMoney
=
totalMoney
;
}
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/mapper/FinanceTradeFlowDao.java
View file @
d22a126f
package
com
.
jz
.
dm
.
mall
.
moduls
.
mapper
;
import
com.jz.common.base.BaseMapper
;
import
com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto
;
import
com.jz.dm.mall.moduls.entity.FinanceTradeFlow
;
import
java.util.Map
;
/**
* 企业客户交易流水(TFinanceTradeFlow)表数据库访问层
*
...
...
@@ -13,4 +16,5 @@ import com.jz.dm.mall.moduls.entity.FinanceTradeFlow;
public
interface
FinanceTradeFlowDao
extends
BaseMapper
<
FinanceTradeFlow
>
{
FinanceCustomerAssetsDto
queryAccountMoneyByMap
(
Map
map
)
throws
Exception
;
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
View file @
d22a126f
...
...
@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.mapper;
import
com.jz.common.base.BaseMapper
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.ResultType
;
import
org.apache.ibatis.annotations.Select
;
...
...
@@ -29,6 +30,10 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
*/
MallCustomer
selectByPhone
(
String
username
);
@Insert
(
"INSERT into t_mall_customer(customer_account, customer_phone, password) VALUES (#{customerAccount},#{customerPhone}, #{password})"
)
@ResultType
(
MallCustomer
.
class
)
void
saveCustomer
(
MallCustomer
mallCustomer
);
/**
* 根据ID查询用户信息
* @param customerId
...
...
@@ -37,4 +42,5 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
@Select
(
"select * from t_mall_customer where customer_id =#{customerId}"
)
@ResultType
(
MallCustomer
.
class
)
MallCustomer
findById
(
Long
customerId
);
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/FinanceTradeFlowService.java
View file @
d22a126f
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
;
import
com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto
;
import
java.util.Map
;
/**
* 企业客户交易流水(TFinanceTradeFlow)表服务接口
*
...
...
@@ -9,4 +13,5 @@ package com.jz.dm.mall.moduls.service;
public
interface
FinanceTradeFlowService
{
FinanceCustomerAssetsDto
queryAccountMoneyByMap
(
Map
map
)
throws
Exception
;
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/MallCustomerService.java
View file @
d22a126f
...
...
@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.service;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Map
;
/**
...
...
@@ -17,14 +18,18 @@ public interface MallCustomerService {
* @param username
* @return
*/
MallCustomer
selectByAccount
(
String
username
);
MallCustomer
selectByAccount
(
String
username
,
HttpServletRequest
request
);
/**
* 通过手机号进行查询
* @param username
* @return
*/
MallCustomer
selectByPhone
(
String
username
);
MallCustomer
selectByPhone
(
String
username
,
HttpServletRequest
request
);
/**
* 注册账号
* @param paramMap
*/
void
saveCustomer
(
Map
<
String
,
String
>
paramMap
);
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/FinanceTradeFlowServiceImpl.java
View file @
d22a126f
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
.
impl
;
import
com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto
;
import
com.jz.dm.mall.moduls.mapper.FinanceTradeFlowDao
;
import
com.jz.dm.mall.moduls.service.FinanceTradeFlowService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Map
;
/**
* 企业客户交易流水(TFinanceTradeFlow)表服务实现类
*
...
...
@@ -13,7 +16,12 @@ import org.springframework.stereotype.Service;
*/
@Service
(
"financeTradeFlowService"
)
public
class
FinanceTradeFlowServiceImpl
implements
FinanceTradeFlowService
{
@Autowired
private
FinanceTradeFlowDao
tF
inanceTradeFlowDao
;
private
FinanceTradeFlowDao
f
inanceTradeFlowDao
;
@Override
public
FinanceCustomerAssetsDto
queryAccountMoneyByMap
(
Map
map
)
throws
Exception
{
return
financeTradeFlowDao
.
queryAccountMoneyByMap
(
map
);
}
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
View file @
d22a126f
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
.
impl
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.enums.UserTypeEnum
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.common.bean.MallCustomerApiDto
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.mapper.MallCustomerDao
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
/**
* 商城用户(TMallCustomer)表服务实现类
*
...
...
@@ -18,6 +29,9 @@ public class MallCustomerServiceImpl implements MallCustomerService {
@Autowired
private
MallCustomerDao
tMallCustomerDao
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 通过用户账号进行查询
*
...
...
@@ -25,10 +39,28 @@ public class MallCustomerServiceImpl implements MallCustomerService {
* @return
*/
@Override
public
MallCustomer
selectByAccount
(
String
username
)
{
return
tMallCustomerDao
.
selectByAccount
(
username
);
public
MallCustomer
selectByAccount
(
String
username
,
HttpServletRequest
request
)
{
MallCustomer
mallCustomer
=
tMallCustomerDao
.
selectByAccount
(
username
);
// String customer = JSON.toJSONString(mallCustomer);
if
(
mallCustomer
!=
null
)
{
MallCustomerApiDto
mallCustomerApiDto
=
new
MallCustomerApiDto
();
// 赋值
mallCustomerApiDto
.
setCustomerId
(
mallCustomer
.
getCustomerId
());
mallCustomerApiDto
.
setDepartmentId
(
mallCustomer
.
getDepartmentId
());
mallCustomerApiDto
.
setUserTypeEnum
(
UserTypeEnum
.
COMPANY_ROLE
);
mallCustomerApiDto
.
setCustomerAccount
(
mallCustomer
.
getCustomerAccount
());
mallCustomerApiDto
.
setCustomerName
(
mallCustomer
.
getCustomerName
());
// 存入到session
request
.
getSession
().
setAttribute
(
"mallCustomer"
,
mallCustomerApiDto
);
// 存入到redis
redisTemplate
.
opsForValue
().
set
(
"user_"
+
RedisMessageConstant
.
SENDTYPE_LOGIN_CUSTOMER
,
mallCustomerApiDto
,
3
,
TimeUnit
.
DAYS
);
}
return
mallCustomer
;
}
/**
* 通过手机号进行查询
*
...
...
@@ -36,9 +68,46 @@ public class MallCustomerServiceImpl implements MallCustomerService {
* @return
*/
@Override
public
MallCustomer
selectByPhone
(
String
username
)
{
return
tMallCustomerDao
.
selectByPhone
(
username
);
public
MallCustomer
selectByPhone
(
String
username
,
HttpServletRequest
request
)
{
MallCustomer
mallCustomer
=
tMallCustomerDao
.
selectByPhone
(
username
);
if
(
mallCustomer
!=
null
)
{
MallCustomerApiDto
mallCustomerApiDto
=
new
MallCustomerApiDto
();
// 赋值
mallCustomerApiDto
.
setCustomerId
(
mallCustomer
.
getCustomerId
());
mallCustomerApiDto
.
setDepartmentId
(
mallCustomer
.
getDepartmentId
());
mallCustomerApiDto
.
setUserTypeEnum
(
UserTypeEnum
.
COMPANY_ROLE
);
mallCustomerApiDto
.
setCustomerAccount
(
mallCustomer
.
getCustomerAccount
());
mallCustomerApiDto
.
setCustomerName
(
mallCustomer
.
getCustomerName
());
// 存入到session
SessionUtils
.
setUserCurrent
(
"mallCustomer"
,
mallCustomerApiDto
,
request
);
// 存入到redis
redisTemplate
.
opsForValue
().
set
(
"user_"
+
RedisMessageConstant
.
SENDTYPE_LOGIN_CUSTOMER
,
mallCustomerApiDto
,
3
,
TimeUnit
.
DAYS
);
}
return
mallCustomer
;
}
/**
* 注册账号
*
* @param paramMap
*/
@Override
public
void
saveCustomer
(
Map
<
String
,
String
>
paramMap
)
{
MallCustomer
mallCustomer
=
new
MallCustomer
();
// 获取验证码
String
vailCode
=
paramMap
.
get
(
"vailCode"
);
String
telephone
=
paramMap
.
get
(
"telephone"
);
// 从redis获取验证码
// String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
String
key
=
"18179617425"
;
// String codeInRedis = (String) redisTemplate.opsForValue().get(key);
String
codeInRedis
=
"147826"
;
if
(
codeInRedis
.
equals
(
vailCode
))
{
mallCustomer
.
setCustomerAccount
(
paramMap
.
get
(
"username"
));
mallCustomer
.
setPassword
(
paramMap
.
get
(
"password"
));
mallCustomer
.
setCustomerPhone
(
telephone
);
tMallCustomerDao
.
saveCustomer
(
mallCustomer
);
}
}
}
\ No newline at end of file
jz-dm-mall/src/main/resources/mapperconf/FinanceCustomerAssetsDao.xml
View file @
d22a126f
...
...
@@ -2,18 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jz.dm.mall.moduls.mapper.FinanceCustomerAssetsDao"
>
<!-- <resultMap type="com.jz.manage.moduls.entity.FinanceCustomerAssets" id="TFinanceCustomerAssetsMap">--
>
<!-- <result property="assetsId" column="assets_id" jdbcType="INTEGER"/>--
>
<!-- <result property="departmentId" column="department_id" jdbcType="INTEGER"/>--
>
<!-- <result property="useMoney" column="use_money" jdbcType="NUMERIC"/>--
>
<!-- <result property="frozenMoney" column="frozen_money" jdbcType="NUMERIC"/>--
>
<!-- <result property="totalMoney" column="total_money" jdbcType="NUMERIC"/>--
>
<!-- <result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>--
>
<!-- <result property="crePerson" column="cre_person" jdbcType="VARCHAR"/>--
>
<!-- <result property="uptTime" column="upt_time" jdbcType="TIMESTAMP"/>--
>
<!-- <result property="uptPerson" column="upt_person" jdbcType="VARCHAR"/>--
>
<!-- <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>--
>
<!-- </resultMap>--
>
<resultMap
type=
"com.jz.dm.mall.moduls.entity.FinanceCustomerAssets"
id=
"TFinanceCustomerAssetsMap"
>
<result
property=
"assetsId"
column=
"assets_id"
jdbcType=
"INTEGER"
/
>
<result
property=
"departmentId"
column=
"department_id"
jdbcType=
"INTEGER"
/
>
<result
property=
"useMoney"
column=
"use_money"
jdbcType=
"NUMERIC"
/
>
<result
property=
"frozenMoney"
column=
"frozen_money"
jdbcType=
"NUMERIC"
/
>
<result
property=
"totalMoney"
column=
"total_money"
jdbcType=
"NUMERIC"
/
>
<result
property=
"creTime"
column=
"cre_time"
jdbcType=
"TIMESTAMP"
/
>
<result
property=
"crePerson"
column=
"cre_person"
jdbcType=
"VARCHAR"
/
>
<result
property=
"uptTime"
column=
"upt_time"
jdbcType=
"TIMESTAMP"
/
>
<result
property=
"uptPerson"
column=
"upt_person"
jdbcType=
"VARCHAR"
/
>
<result
property=
"delFlag"
column=
"del_flag"
jdbcType=
"VARCHAR"
/
>
</resultMap
>
<!--查询单个-->
<select
id=
"queryById"
resultMap=
"TFinanceCustomerAssetsMap"
>
...
...
jz-dm-mall/src/main/resources/mapperconf/FinanceTradeFlowDao.xml
0 → 100644
View file @
d22a126f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jz.dm.mall.moduls.mapper.FinanceTradeFlowDao"
>
<!--商城 充值 只有已审核(认证)企业-->
<select
id=
"queryAccountMoneyByMap"
resultType=
"com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto"
parameterType=
"map"
>
select
assets_id as assetsId,
department_id as departmentId,
use_money as useMoney,
frozen_money as frozenMoney,
total_money as totalMoney
from t_finance_customer_assets t
left join t_department t1 on t.department_id=t1.department_id and t1.audit_status='02'
where 1=1
<if
test=
"assetsId != null"
>
and assets_id = #{assetsId}
</if>
<if
test=
"departmentId != null"
>
and department_id = #{departmentId}
</if>
</select>
</mapper>
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/sys/LoginController.java
View file @
d22a126f
...
...
@@ -3,6 +3,7 @@ package com.jz.manage.moduls.controller.sys;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.entity.SysUser
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.manage.moduls.controller.BaseController
;
import
com.jz.manage.moduls.service.SysUserService
;
...
...
@@ -38,14 +39,12 @@ public class LoginController extends BaseController {
public
Result
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
{
// 手机
String
ph
=
"^[1][34578]\\d{9}$"
;
HttpSession
session
=
request
.
getSession
();
// 如果是手机验证
if
(
username
.
matches
(
username
))
{
SysUser
sysUser
=
sysUserService
.
selectByPhone
(
username
);
if
(
sysUser
!=
null
)
{
if
(
sysUser
.
getTelephone
().
equals
(
username
)
&&
sysUser
.
getPassword
().
equals
(
password
)){
session
.
setAttribute
(
"account"
,
sysUser
.
getAccount
());
session
.
setAttribute
(
"password"
,
sysUser
.
getPassword
());
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
...
...
@@ -54,8 +53,6 @@ public class LoginController extends BaseController {
SysUser
sysUser
=
sysUserService
.
selectByUsername
(
username
);
if
(
sysUser
!=
null
)
{
if
(
sysUser
.
getAccount
().
equals
(
username
)
&&
sysUser
.
getPassword
().
equals
(
password
)){
session
.
setAttribute
(
"account"
,
sysUser
.
getAccount
());
session
.
setAttribute
(
"password"
,
sysUser
.
getPassword
());
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
}
...
...
@@ -64,7 +61,6 @@ public class LoginController extends BaseController {
/**
* 手机号码校验
* @param paramMap
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/sys/bean/SysUserDto.java
0 → 100644
View file @
d22a126f
package
com
.
jz
.
manage
.
moduls
.
controller
.
sys
.
bean
;
import
com.jz.common.enums.UserTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
/**
* @ClassName: 后台用户状态信息
* @Author: Carl
* @Date: 2020/12/3
* @Version:
*/
@ApiModel
public
class
SysUserDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8194718171444972705L
;
/**
* 平台用户id
*/
@ApiModelProperty
(
value
=
"平台用户id"
)
private
Long
userId
;
/**
* 组织机构id
*/
@ApiModelProperty
(
value
=
"组织机构id"
)
private
Long
orgId
;
/**
* 用户姓名
*/
@ApiModelProperty
(
value
=
"用户姓名"
)
private
String
userName
;
/**
* 账户
*/
@ApiModelProperty
(
value
=
"账户"
)
private
String
account
;
/**
* 电话
*/
@ApiModelProperty
(
value
=
"账号类型"
)
private
UserTypeEnum
userTypeEnum
;
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
public
Long
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;
}
public
Long
getOrgId
()
{
return
orgId
;
}
public
void
setOrgId
(
Long
orgId
)
{
this
.
orgId
=
orgId
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getAccount
()
{
return
account
;
}
public
void
setAccount
(
String
account
)
{
this
.
account
=
account
;
}
public
UserTypeEnum
getUserTypeEnum
()
{
return
userTypeEnum
;
}
public
void
setUserTypeEnum
(
UserTypeEnum
userTypeEnum
)
{
this
.
userTypeEnum
=
userTypeEnum
;
}
}
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/impl/SysUserServiceImpl.java
View file @
d22a126f
package
com
.
jz
.
manage
.
moduls
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.entity.SysUser
;
import
com.jz.common.enums.UserTypeEnum
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.manage.moduls.controller.sys.bean.SysUserDto
;
import
com.jz.manage.moduls.mapper.SysUserDao
;
import
com.jz.manage.moduls.service.SysUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
* 平台系统用户表(SysUser)表服务实现类
...
...
@@ -23,19 +29,50 @@ public class SysUserServiceImpl implements SysUserService {
@Autowired
private
SysUserDao
sysUserDao
;
@Autowired
private
RedisTemplate
redisTemplate
;
@Override
public
SysUser
selectByUsername
(
String
account
)
{
public
SysUser
selectByUsername
(
String
username
)
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"account"
,
account
);
return
sysUserDao
.
selectOne
(
queryWrapper
);
}
queryWrapper
.
eq
(
"account"
,
username
);
SysUser
sysUser
=
sysUserDao
.
selectOne
(
queryWrapper
);
if
(
sysUser
!=
null
)
{
SysUserDto
SysUserDto
=
new
SysUserDto
();
// 赋值
SysUserDto
.
setUserId
(
sysUser
.
getUserId
());
SysUserDto
.
setOrgId
(
sysUser
.
getOrgId
());
SysUserDto
.
setAccount
(
sysUser
.
getAccount
());
SysUserDto
.
setUserTypeEnum
(
UserTypeEnum
.
BACKGROUND_ROLE
);
SysUserDto
.
setUserName
(
sysUser
.
getUserName
());
// 存入到session
SessionUtils
.
setUserCurrent
(
"sysUser"
,
SysUserDto
);
// 存入到redis
redisTemplate
.
opsForValue
().
set
(
"user_"
+
RedisMessageConstant
.
SENDTYPE_LOGIN_SYS
,
SysUserDto
,
3
,
TimeUnit
.
DAYS
);
}
return
sysUser
;
}
@Override
public
SysUser
selectByPhone
(
String
username
)
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"telephone"
,
username
);
return
sysUserDao
.
selectOne
(
queryWrapper
);
SysUser
sysUser
=
sysUserDao
.
selectOne
(
queryWrapper
);
if
(
sysUser
!=
null
)
{
SysUserDto
SysUserDto
=
new
SysUserDto
();
// 赋值
SysUserDto
.
setUserId
(
sysUser
.
getUserId
());
SysUserDto
.
setOrgId
(
sysUser
.
getOrgId
());
SysUserDto
.
setAccount
(
sysUser
.
getAccount
());
SysUserDto
.
setUserTypeEnum
(
UserTypeEnum
.
BACKGROUND_ROLE
);
SysUserDto
.
setUserName
(
sysUser
.
getUserName
());
// 存入到session
SessionUtils
.
setUserCurrent
(
"sysUser"
,
SysUserDto
);
// 存入到redis
redisTemplate
.
opsForValue
().
set
(
"user_"
+
RedisMessageConstant
.
SENDTYPE_LOGIN_SYS
,
SysUserDto
,
3
,
TimeUnit
.
DAYS
);
}
return
sysUser
;
}
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment