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
5fac08e1
Commit
5fac08e1
authored
Dec 03, 2020
by
machengbo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm_dev' of
http://gitlab.ioubuy.cn/yaobenzhang/dm_project
into dm_dev
parents
d031ddbd
d22a126f
Changes
35
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
1234 additions
and
199 deletions
+1234
-199
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
Result.java
jz-dm-common/src/main/java/com/jz/common/utils/Result.java
+83
-48
SessionUtils.java
...ommon/src/main/java/com/jz/common/utils/SessionUtils.java
+5
-11
CompanyAuthController.java
...mall/moduls/controller/company/CompanyAuthController.java
+21
-0
CompanyUpdateReq.java
...mall/moduls/controller/company/bean/CompanyUpdateReq.java
+68
-0
CompanyInfoDto.java
...dm/mall/moduls/controller/company/dto/CompanyInfoDto.java
+41
-0
LoginController.java
...z/dm/mall/moduls/controller/customer/LoginController.java
+8
-10
MallCustomerController.java
...ll/moduls/controller/customer/MallCustomerController.java
+28
-0
PersonalUserController.java
...ll/moduls/controller/customer/PersonalUserController.java
+53
-0
ValidateCodeController.java
...ll/moduls/controller/customer/ValidateCodeController.java
+91
-81
LogInfoController.java
...m/jz/dm/mall/moduls/controller/log/LogInfoController.java
+48
-0
LogInfoQueryReq.java
...z/dm/mall/moduls/controller/log/bean/LogInfoQueryReq.java
+22
-0
OrderController.java
...m/jz/dm/mall/moduls/controller/order/OrderController.java
+2
-2
MallCustomer.java
.../main/java/com/jz/dm/mall/moduls/entity/MallCustomer.java
+12
-0
DepartmentDao.java
...main/java/com/jz/dm/mall/moduls/mapper/DepartmentDao.java
+20
-0
MallCustomerDao.java
...in/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
+6
-0
PlatformLogDao.java
...ain/java/com/jz/dm/mall/moduls/mapper/PlatformLogDao.java
+23
-0
CompanyAuthService.java
...ava/com/jz/dm/mall/moduls/service/CompanyAuthService.java
+15
-1
LogInfoService.java
...in/java/com/jz/dm/mall/moduls/service/LogInfoService.java
+26
-0
MallCustomerService.java
...va/com/jz/dm/mall/moduls/service/MallCustomerService.java
+8
-3
PersonalUserControllerService.java
...dm/mall/moduls/service/PersonalUserControllerService.java
+29
-0
CompanyAuthServiceImpl.java
...z/dm/mall/moduls/service/impl/CompanyAuthServiceImpl.java
+100
-26
LogInfoServiceImpl.java
...om/jz/dm/mall/moduls/service/impl/LogInfoServiceImpl.java
+62
-0
MallCustomerServiceImpl.java
.../dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
+73
-4
PersonalUserControllerServiceImpl.java
...oduls/service/impl/PersonalUserControllerServiceImpl.java
+66
-0
DepartmentDao.xml
jz-dm-mall/src/main/resources/mapperconf/DepartmentDao.xml
+15
-0
PlatformLogDao.xml
jz-dm-mall/src/main/resources/mapperconf/PlatformLogDao.xml
+7
-0
TestUserController.java
...a/com/jz/manage/moduls/controller/TestUserController.java
+2
-2
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 @
5fac08e1
...
...
@@ -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 @
5fac08e1
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 @
5fac08e1
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 @
5fac08e1
...
...
@@ -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 @
5fac08e1
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/Result.java
View file @
5fac08e1
package
com
.
jz
.
common
.
utils
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.jz.common.constant.CommonConstant
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultMsg
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -16,8 +19,8 @@ import java.io.Serializable;
*/
@Data
@ApiModel
(
value
=
"接口返回对象"
,
description
=
"接口返回对象"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
Result
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
...
...
@@ -30,19 +33,19 @@ public class Result<T> implements Serializable {
* 返回处理消息
*/
@ApiModelProperty
(
value
=
"返回处理消息"
)
private
String
message
=
"操作成功!"
;
private
String
message
;
/**
* 返回代码
*/
@ApiModelProperty
(
value
=
"返回代码"
)
private
Integer
code
=
200
;
private
Integer
code
;
/**
* 返回数据对象 data
*/
@ApiModelProperty
(
value
=
"返回数据对象"
)
private
T
result
;
private
T
data
;
/**
* 时间戳
...
...
@@ -50,66 +53,92 @@ public class Result<T> implements Serializable {
@ApiModelProperty
(
value
=
"时间戳"
)
private
long
timestamp
=
System
.
currentTimeMillis
();
public
Result
()
{
}
public
Result
<
T
>
success
(
String
message
)
{
this
.
message
=
message
;
this
.
code
=
CommonConstant
.
SC_OK_200
;
this
.
success
=
true
;
return
this
;
private
Result
(
Integer
code
)
{
this
.
code
=
code
;
}
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
/**
* 构造函数
* @param code 操作代码
* @param data 数据对象
*/
private
Result
(
Integer
code
,
T
data
)
{
this
(
code
);
this
.
data
=
data
;
}
public
boolean
isSuccess
()
{
return
success
;
/**
* 构造函数
*
* @param code
* 操作代码
* @param data
* 数据对象
* @param msg
* 提示消息
*/
private
Result
(
Integer
code
,
T
data
,
ResultMsg
msg
)
{
this
(
code
,
data
);
this
.
message
=
msg
.
getMsg
();
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
succes
s
;
public
Result
setMsg
(
ResultMsg
msg
)
{
this
.
message
=
msg
.
getMsg
();
return
thi
s
;
}
public
String
getMessage
()
{
return
message
;
public
Result
setMsg
(
String
msg
)
{
this
.
message
=
msg
;
return
this
;
}
/**
* 构造函数
*
* @param code
* 操作代码
* @param data
* 数据对象
* @param msg
* 提示消息
*/
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
private
Result
(
Integer
code
,
T
data
,
String
msg
)
{
this
(
code
,
data
);
this
.
message
=
msg
;
}
public
Integer
getCode
()
{
return
code
;
/**new Add*/
public
Result
()
{
this
.
code
=
ResultCode
.
SUCCESS
.
getCode
();
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
public
static
Result
of_success
(
ResultMsg
msg
,
Object
data
)
{
Result
resultJson
=
new
Result
(
ResultCode
.
SUCCESS
.
getCode
(),
data
,
msg
);
return
resultJson
;
}
public
T
getResult
()
{
return
result
;
public
static
Result
of_success
(
Object
data
)
{
Result
resultJson
=
new
Result
(
ResultCode
.
SUCCESS
.
getCode
(),
data
);
resultJson
.
setMessage
(
ResultMsg
.
SUCCESS
.
getMsg
());
return
resultJson
;
}
public
void
setResult
(
T
result
)
{
this
.
result
=
result
;
public
static
Result
of_success
(
ResultMsg
msg
)
{
Result
resultJson
=
new
Result
(
ResultCode
.
SUCCESS
.
getCode
(),
null
,
msg
);
return
resultJson
;
}
public
long
getTimestamp
()
{
return
timestamp
;
public
static
Result
of_error
(
ResultMsg
msg
)
{
Result
resultJson
=
new
Result
(
ResultCode
.
FAILURE
.
getCode
(),
null
,
msg
);
return
resultJson
;
}
public
void
setTimestamp
(
long
timestamp
)
{
this
.
timestamp
=
timestamp
;
public
static
Result
of_error
(
Object
data
)
{
Result
resultJson
=
new
Result
(
ResultCode
.
FAILURE
.
getCode
(),
data
);
return
resultJson
;
}
@Deprecated
public
static
Result
of_error
(
String
msg
)
{
Result
resultJson
=
new
Result
(
ResultCode
.
FAILURE
.
getCode
(),
null
,
msg
);
return
resultJson
;
}
public
Result
(
boolean
success
,
String
message
)
{
this
.
success
=
success
;
this
.
message
=
message
;
}
public
Result
(
boolean
success
,
String
message
,
Integer
code
)
{
this
.
success
=
success
;
this
.
message
=
message
;
...
...
@@ -120,14 +149,14 @@ public class Result<T> implements Serializable {
this
.
success
=
success
;
this
.
message
=
message
;
this
.
code
=
code
;
this
.
result
=
result
;
this
.
data
=
result
;
}
public
Result
(
boolean
success
,
String
message
,
Integer
code
,
T
result
,
long
timestamp
)
{
this
.
success
=
success
;
this
.
message
=
message
;
this
.
code
=
code
;
this
.
result
=
result
;
this
.
data
=
result
;
this
.
timestamp
=
timestamp
;
}
...
...
@@ -151,7 +180,7 @@ public class Result<T> implements Serializable {
Result
<
Object
>
r
=
new
Result
<
Object
>();
r
.
setSuccess
(
true
);
r
.
setCode
(
CommonConstant
.
SC_OK_200
);
r
.
set
Result
(
data
);
r
.
set
Data
(
data
);
return
r
;
}
...
...
@@ -173,5 +202,11 @@ public class Result<T> implements Serializable {
this
.
success
=
false
;
return
this
;
}
public
Result
<
T
>
success
(
String
message
)
{
this
.
message
=
message
;
this
.
code
=
CommonConstant
.
SC_OK_200
;
this
.
success
=
true
;
return
this
;
}
}
jz-dm-common/src/main/java/com/jz/common/utils/SessionUtils.java
View file @
5fac08e1
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/src/main/java/com/jz/dm/mall/moduls/controller/company/CompanyAuthController.java
View file @
5fac08e1
...
...
@@ -4,6 +4,7 @@ import com.aliyuncs.http.HttpRequest;
import
com.jz.common.entity.Department
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyUpdateReq
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.service.CompanyAuthService
;
import
io.swagger.annotations.Api
;
...
...
@@ -59,4 +60,24 @@ public class CompanyAuthController {
return
Result
.
ok
(
companyAuthService
.
selectCompany
(
type
));
});
}
/**
* @Description: 企业认证信息更新
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@GetMapping
(
"/updateCompany"
)
@ApiOperation
(
value
=
"企业认证信息更新"
)
public
Mono
<
Result
>
updateCompany
(
@RequestBody
@Validated
CompanyUpdateReq
req
)
{
return
Mono
.
fromSupplier
(()
->
companyAuthService
.
updateCompanyInfo
(
req
));
}
/**
* @Description: 企业认证信息更新
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@GetMapping
(
"/checkCompany"
)
@ApiOperation
(
value
=
"企业认证信息校验"
)
public
Mono
<
Result
>
checkCompany
()
{
return
Mono
.
fromSupplier
(()
->
companyAuthService
.
checkCompanyInfo
());
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/company/bean/CompanyUpdateReq.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
company
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.company.bean
* @PROJECT_NAME: jz-dm-parent
* @NAME: CompanyUpdateReq
* @USER: key
* @DATE: 2020-12-3/15:32
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
public
class
CompanyUpdateReq
implements
Serializable
{
@ApiModelProperty
(
name
=
"企业ID"
,
required
=
true
)
@NotNull
(
message
=
"企业Id不能为空"
)
private
Long
departmentId
;
@ApiModelProperty
(
name
=
"企业名称"
,
required
=
true
)
@NotNull
(
message
=
"企业名称不能为空"
)
private
String
departmentName
;
@ApiModelProperty
(
name
=
"省"
,
required
=
true
)
@NotNull
(
message
=
"省信息不能为空"
)
private
String
province
;
@ApiModelProperty
(
name
=
"市"
,
required
=
true
)
@NotNull
(
message
=
"市信息不能为空"
)
private
String
city
;
@ApiModelProperty
(
name
=
"公司详细地址"
,
required
=
true
)
@NotNull
(
message
=
"公司详细地址不能为空"
)
private
String
registeredAddress
;
@ApiModelProperty
(
name
=
"统一社会编码"
,
required
=
true
)
@NotNull
(
message
=
"统一社会编码不能忍为空"
)
private
String
unifiedCreditCode
;
@ApiModelProperty
(
name
=
"营业执照照片"
,
required
=
true
)
@NotNull
(
message
=
"营业执照照片不能忍为空"
)
private
String
businessLicense
;
@ApiModelProperty
(
name
=
"开户银行"
,
required
=
true
)
@NotNull
(
message
=
"开户银行不能为空"
)
private
String
bankName
;
@ApiModelProperty
(
name
=
"银行账户"
,
required
=
true
)
@NotNull
(
message
=
"银行账户不能忍为空"
)
private
String
bankCardNumber
;
@ApiModelProperty
(
name
=
"联系人名称"
,
required
=
true
)
@NotNull
(
message
=
"联系人名称不能为空"
)
private
String
linkman
;
@ApiModelProperty
(
name
=
"联系人电话"
,
required
=
true
)
@NotNull
(
message
=
"联系人电话不能为空"
)
private
String
telephone
;
@ApiModelProperty
(
name
=
"登录用户id"
,
hidden
=
true
)
private
Long
customerId
;
@ApiModelProperty
(
name
=
"登录用户名称"
,
hidden
=
true
)
private
String
loginName
;
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/company/dto/CompanyInfoDto.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
company
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.company.dto
* @PROJECT_NAME: jz-dm-parent
* @NAME: CompanyInfoDto
* @USER: key
* @DATE: 2020-12-3/15:23
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
public
class
CompanyInfoDto
implements
Serializable
{
@ApiModelProperty
(
value
=
"企业名称"
)
private
String
departmentName
;
@ApiModelProperty
(
value
=
"注册地址"
)
private
String
registeredAddress
;
@ApiModelProperty
(
value
=
"营业执照链接"
)
private
String
businessLicense
;
@ApiModelProperty
(
value
=
"开户行"
)
private
String
bankName
;
@ApiModelProperty
(
value
=
"企业名称"
)
private
String
bankCardNumber
;
@ApiModelProperty
(
value
=
"联系人"
)
private
String
linkman
;
@ApiModelProperty
(
value
=
"联系人手机号"
)
private
String
telephone
;
@ApiModelProperty
(
value
=
"企业自增ID"
)
private
String
departmentId
;
@ApiModelProperty
(
value
=
"审核状态:01待审核,02已审核,03未通过"
)
private
String
auditStatus
;
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/LoginController.java
View file @
5fac08e1
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 @
5fac08e1
...
...
@@ -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/PersonalUserController.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
import
com.jz.dm.mall.moduls.service.PersonalUserControllerService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
reactor.core.publisher.Mono
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.customer
* @PROJECT_NAME: jz-dm-parent
* @NAME: PersonalUserController
* @USER: key
* @DATE: 2020-12-3/18:01
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@RestController
@RequestMapping
(
"/personalUser"
)
@Api
(
tags
=
"用户信息controller"
)
public
class
PersonalUserController
{
@Autowired
private
PersonalUserControllerService
personalUserControllerService
;
/**
* @Description: 查询个人信息
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping
(
"/getPersonalInfo"
)
@ApiOperation
(
value
=
"查询个人信息"
)
public
Mono
<
Result
>
getUserInfo
()
{
return
Mono
.
fromSupplier
(()
->
personalUserControllerService
.
getUserInfo
());
}
/**
* @Description: 修改用户密码
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping
(
"/updatePassWard"
)
@ApiOperation
(
value
=
"修改用户密码"
)
public
Mono
<
Result
>
updateUserPassWard
(
@RequestParam
(
value
=
"oldPassWard"
)
String
oldPassWard
,
@RequestParam
(
value
=
"newPassWard"
)
String
newPassWard
)
{
return
Mono
.
fromSupplier
(()
->
personalUserControllerService
.
updateUserPassWard
(
oldPassWard
,
newPassWard
));
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/ValidateCodeController.java
View file @
5fac08e1
//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/log/LogInfoController.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
log
;
import
com.jz.common.bean.PageInfoResponse
;
import
com.jz.common.entity.PlatformLog
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
import
com.jz.dm.mall.moduls.controller.log.bean.LogInfoQueryReq
;
import
com.jz.dm.mall.moduls.controller.order.bean.OrderDto
;
import
com.jz.dm.mall.moduls.service.LogInfoService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
reactor.core.publisher.Mono
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.log
* @PROJECT_NAME: jz-dm-parent
* @NAME: LogInfoController
* @USER: key
* @DATE: 2020-12-3
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@RestController
@RequestMapping
(
"/logInfo"
)
@Api
(
tags
=
"日志信息controller"
)
public
class
LogInfoController
{
@Autowired
private
LogInfoService
logInfoService
;
/**
* @Description: 添加企业认证信息
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping
(
"/getMallLogInfo"
)
@ApiOperation
(
value
=
"获取商城用户日志信息"
)
public
Mono
<
Result
<
PageInfoResponse
<
PlatformLog
>>>
getLogInfo
(
@RequestBody
@Validated
LogInfoQueryReq
req
)
{
return
Mono
.
fromSupplier
(()
->
logInfoService
.
getMallUserLogInfo
(
req
));
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/log/bean/LogInfoQueryReq.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
log
.
bean
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.log.bean
* @PROJECT_NAME: jz-dm-parent
* @NAME: LogInfoQueryReq
* @USER: key
* @DATE: 2020-12-3/19:05
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
public
class
LogInfoQueryReq
extends
BasePageBean
implements
Serializable
{
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/order/OrderController.java
View file @
5fac08e1
...
...
@@ -64,7 +64,7 @@ public class OrderController {
Result
<
OrderDto
>
result
=
new
Result
<
OrderDto
>();
if
(
StringUtils
.
isNotEmpty
(
orderId
))
{
OrderDto
orderDto
=
orderService
.
getOrderDetail
(
orderId
);
result
.
set
Result
(
orderDto
);
result
.
set
Data
(
orderDto
);
}
else
{
result
.
setMessage
(
"参数为不能为空!"
);
}
...
...
@@ -91,7 +91,7 @@ public class OrderController {
}
//查询接口文档 和参数信息
Map
dataGoodsApi
=
orderService
.
getApiInterfaceDetail
(
params
);
result
.
set
Result
(
dataGoodsApi
);
result
.
set
Data
(
dataGoodsApi
);
return
result
;
}
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/entity/MallCustomer.java
View file @
5fac08e1
...
...
@@ -75,12 +75,24 @@ public class MallCustomer implements Serializable {
* 更新时间
*/
private
Date
uptTime
;
/**
* 更新人
*/
private
String
uptPerson
;
/**
* 删除标识:Y是,N否
*/
private
String
delFlag
;
public
String
getUptPerson
()
{
return
uptPerson
;
}
public
void
setUptPerson
(
String
uptPerson
)
{
this
.
uptPerson
=
uptPerson
;
}
public
Long
getCustomerId
()
{
return
customerId
;
}
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/mapper/DepartmentDao.java
View file @
5fac08e1
...
...
@@ -3,6 +3,10 @@ package com.jz.dm.mall.moduls.mapper;
import
com.jz.common.base.BaseMapper
;
import
com.jz.common.entity.Department
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
import
com.jz.dm.mall.moduls.controller.company.dto.CompanyInfoDto
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.ResultType
;
import
org.apache.ibatis.annotations.Select
;
/**
* 企业(TDepartment)表数据库访问层
...
...
@@ -18,4 +22,20 @@ public interface DepartmentDao extends BaseMapper<Department> {
* @return
*/
Department
selectDepartmentData
(
CompanyAddReq
req
);
/**
* 查询企业状态
* @param departmentId
* @return
*/
@Select
(
"select audit_status AS auditStatus from t_department where department_id =#{departmentId} and del_flag ='N'"
)
@ResultType
(
String
.
class
)
String
selectCompanyStatus
(
Long
departmentId
);
/**
* 根据企业ID查询企业信息
* @param departmentId
* @return
*/
CompanyInfoDto
selectCompanyDetail
(
@Param
(
"departmentId"
)
Long
departmentId
);
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
View file @
5fac08e1
...
...
@@ -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/mapper/PlatformLogDao.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
mapper
;
import
com.jz.common.base.BaseMapper
;
import
com.jz.common.entity.PlatformLog
;
import
com.jz.dm.mall.moduls.controller.order.bean.OrderDto
;
import
java.util.List
;
/**
* 日志管理(TPlatformLog)表数据库访问层
*
* @author Bellamy
* @since 2020-12-01 10:41:42
*/
public
interface
PlatformLogDao
extends
BaseMapper
<
PlatformLog
>
{
/**
* 查询商城用户日志列表
* @param customerId
* @return
*/
List
<
PlatformLog
>
listMallLogInfo
(
Long
customerId
);
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/CompanyAuthService.java
View file @
5fac08e1
...
...
@@ -3,6 +3,7 @@ package com.jz.dm.mall.moduls.service;
import
com.jz.common.entity.Department
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyUpdateReq
;
/**
* @author ZC
...
...
@@ -27,7 +28,20 @@ public interface CompanyAuthService {
* @param type
* @return
*/
Result
<
Department
>
selectCompany
(
String
type
);
Result
selectCompany
(
String
type
);
/**
* 更新企业信息
* @param req
* @return
*/
Result
updateCompanyInfo
(
CompanyUpdateReq
req
);
/**
* 校验当前用户是否已经企业认证
* @return
*/
Result
checkCompanyInfo
();
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/LogInfoService.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
;
import
com.jz.common.bean.PageInfoResponse
;
import
com.jz.common.entity.PlatformLog
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.log.bean.LogInfoQueryReq
;
import
com.jz.dm.mall.moduls.controller.order.bean.OrderDto
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service
* @PROJECT_NAME: jz-dm-parent
* @NAME: LogInfoService
* @USER: key
* @DATE: 2020-12-3/18:59
* @DAY_NAME_SHORT: 周四
* @Description:
**/
public
interface
LogInfoService
{
/**
* 获取用户调用日志列表
* @param req
* @return
*/
Result
<
PageInfoResponse
<
PlatformLog
>>
getMallUserLogInfo
(
LogInfoQueryReq
req
);
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/MallCustomerService.java
View file @
5fac08e1
...
...
@@ -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/PersonalUserControllerService.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
;
import
com.jz.common.utils.Result
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service
* @PROJECT_NAME: jz-dm-parent
* @NAME: PersonalUserControllerService
* @USER: key
* @DATE: 2020-12-3/18:04
* @DAY_NAME_SHORT: 周四
* @Description:
**/
public
interface
PersonalUserControllerService
{
/**
* 获取登录用户信息
* @return
*/
Result
getUserInfo
();
/**
* 修改用户密码
* @param oldPassWard
* @param newPassWard
* @return
*/
Result
updateUserPassWard
(
String
oldPassWard
,
String
newPassWard
);
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/CompanyAuthServiceImpl.java
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
.
impl
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.entity.Department
;
import
com.jz.common.exception.ResponseException
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyUpdateReq
;
import
com.jz.dm.mall.moduls.controller.company.dto.CompanyInfoDto
;
import
com.jz.dm.mall.moduls.entity.FinanceCustomerAssets
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.common.utils.Result
;
...
...
@@ -40,6 +44,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
private
FinanceCustomerAssetsDao
financeCustomerAssetsDao
;
@Resource
private
MallCustomerDao
mallCustomerDao
;
/**
* 添加企业认证
*
...
...
@@ -47,54 +52,123 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Result
addCompanyData
(
CompanyAddReq
req
)
{
//TODO 获取当前用户ID判断当前用户是否已经关联企业
// Long customerId = (Long) UserContextUtil.pop("customer_id");
Long
customerId
=
0L
;
if
(
null
==
customerId
)
{
return
Result
.
error
(
"获取用户信息失败"
);
if
(
null
==
customerId
)
{
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
}
MallCustomer
mallCustomer
=
mallCustomerDao
.
findById
(
customerId
);
if
(
null
==
mallCustomer
){
return
Result
.
error
(
"用户信息不存在"
);
if
(
null
==
mallCustomer
)
{
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
}
if
(
null
!=
mallCustomer
.
getDepartmentId
()){
return
Result
.
error
(
"用户已关联企业,请勿重复操作"
);
if
(
null
!=
mallCustomer
.
getDepartmentId
())
{
return
Result
.
of_
error
(
"用户已关联企业,请勿重复操作"
);
}
req
.
setCustomerId
(
mallCustomer
.
getCustomerId
());
if
(
StringUtils
.
isNotBlank
(
req
.
getDepartmentName
())
&&
StringUtils
.
isNotBlank
(
req
.
getUnifiedCreditCode
()))
{
//企业名称 && 营业执照
Department
department
=
departmentDao
.
selectDepartmentData
(
req
);
if
(
null
!=
department
)
{
return
Result
.
error
(
"企业用户信息已存在"
);
return
Result
.
of_
error
(
"企业用户信息已存在"
);
}
}
insetCompany
(
req
);
return
Result
.
o
k
(
"添加企业用户成功"
);
return
Result
.
o
f_success
(
ResultMsg
.
SUCCESS
);
}
/**
* 查询企业认证详情
*
* @param type
* @return
*/
@Override
public
Result
<
Department
>
selectCompany
(
String
type
)
{
//查询用户判断用户是否认证
// Long customerId = (Long) UserContextUtil.pop("customer_id");
// if (null ==customerId){
// return Result.error("获取用户信息失败");
// }
// MallCustomer mallCustomer = mallCustomerDao.findById(customerId);
// if (null == mallCustomer){
// return Result.error("用户信息不存在");
// }
public
Result
selectCompany
(
String
type
)
{
// TODO 查询用户判断用户是否认证
MallCustomer
currentUser
=
getCurrentUser
(
0L
);
if
(
null
==
currentUser
)
{
return
Result
.
error
(
"当前用户信息不存在"
);
}
if
(
StringUtils
.
equals
(
type
,
"STATUS"
))
{
//状态
String
auditStatus
=
departmentDao
.
selectCompanyStatus
(
currentUser
.
getDepartmentId
());
return
Result
.
of_success
(
auditStatus
);
}
else
if
(
StringUtils
.
equals
(
type
,
"DETAIL"
))
{
//详情
CompanyInfoDto
department
=
departmentDao
.
selectCompanyDetail
(
currentUser
.
getDepartmentId
());
return
Result
.
of_success
(
department
);
}
return
Result
.
of_error
(
"查询企业信息异常"
);
}
/**
* 获取登录用户信息
*
* @param customerId
* @return
*/
private
MallCustomer
getCurrentUser
(
Long
customerId
)
{
try
{
MallCustomer
mallCustomer
=
mallCustomerDao
.
findById
(
customerId
);
if
(
null
!=
mallCustomer
)
{
return
mallCustomer
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
"用户:"
+
customerId
+
"信息不存在~~~~~~~~~~"
);
}
return
null
;
}
/**
* 更新企业信息
*
* @param req
* @return
*/
@Override
public
Result
updateCompanyInfo
(
CompanyUpdateReq
req
)
{
Long
coustomId
=
0L
;
MallCustomer
currentUser
=
getCurrentUser
(
req
.
getCustomerId
());
if
(
null
==
currentUser
)
{
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
}
if
(!
req
.
getDepartmentId
().
equals
(
coustomId
))
{
return
Result
.
of_error
(
"更新企业用户信息与绑定企业信息不一致"
);
}
Department
department
=
new
Department
();
department
.
setUptTime
(
new
Date
());
department
.
setUptPerson
(
req
.
getLoginName
());
BeanUtils
.
copyProperties
(
req
,
department
);
if
(
departmentDao
.
updateById
(
department
)
!=
1
)
{
throw
ResponseException
.
of_error
(
"更新企业信息失败"
);
}
return
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
);
}
/**
* 校验用户是否已经企业认证
*
* @return
*/
@Override
public
Result
checkCompanyInfo
()
{
//Todo 获取当前登录用户
Long
customId
=
0L
;
MallCustomer
currentUser
=
getCurrentUser
(
customId
);
if
(
null
==
currentUser
)
{
return
Result
.
of_success
(
ResultMsg
.
USER_NOT_EXIST
);
}
CompanyInfoDto
companyInfoDto
=
departmentDao
.
selectCompanyDetail
(
currentUser
.
getDepartmentId
());
if
(
null
!=
companyInfoDto
&&
"02"
.
equals
(
companyInfoDto
.
getAuditStatus
()))
{
return
Result
.
of_success
(
"用户已进行企业认证"
);
}
return
Result
.
of_success
(
"用户未进行企业认证"
);
}
/**
* 保存企业信息
*
* @param req
*/
private
void
insetCompany
(
CompanyAddReq
req
)
{
...
...
@@ -103,8 +177,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
departmentInset
.
setAuditStatus
(
"01"
);
//待审核
departmentInset
.
setCreTime
(
new
Date
());
departmentInset
.
setCrePerson
(
req
.
getLoginName
());
BeanUtils
.
copyProperties
(
req
,
departmentInset
);
if
(
departmentDao
.
insert
(
departmentInset
)
!=
1
){
BeanUtils
.
copyProperties
(
req
,
departmentInset
);
if
(
departmentDao
.
insert
(
departmentInset
)
!=
1
)
{
throw
ResponseException
.
of_error
(
"保存企业信息失败"
);
}
//初始化用户资产表
...
...
@@ -112,7 +186,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
finance
.
setDepartmentId
(
departmentInset
.
getDepartmentId
());
//企业ID
finance
.
setCreTime
(
new
Date
());
finance
.
setCrePerson
(
req
.
getLoginName
());
if
(
financeCustomerAssetsDao
.
insert
(
finance
)
!=
1
){
if
(
financeCustomerAssetsDao
.
insert
(
finance
)
!=
1
)
{
throw
ResponseException
.
of_error
(
"初始化用户资产失败"
);
}
//更新用户企业信息
...
...
@@ -120,8 +194,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
mallCustomer
.
setCustomerId
(
req
.
getCustomerId
());
//用户ID
mallCustomer
.
setDepartmentId
(
departmentInset
.
getDepartmentId
());
mallCustomer
.
setUptTime
(
new
Date
());
//
mallCustomer.setUptPerson(req.getLoginName());
if
(
mallCustomerDao
.
updateById
(
mallCustomer
)
!=
1
){
mallCustomer
.
setUptPerson
(
req
.
getLoginName
());
if
(
mallCustomerDao
.
updateById
(
mallCustomer
)
!=
1
)
{
throw
ResponseException
.
of_error
(
"更新用户企业信息失败"
);
}
}
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/LogInfoServiceImpl.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.common.bean.PageInfoResponse
;
import
com.jz.common.constant.Constants
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.entity.PlatformLog
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.log.bean.LogInfoQueryReq
;
import
com.jz.dm.mall.moduls.controller.order.bean.OrderDto
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.mapper.MallCustomerDao
;
import
com.jz.dm.mall.moduls.mapper.PlatformLogDao
;
import
com.jz.dm.mall.moduls.service.LogInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service.impl
* @PROJECT_NAME: jz-dm-parent
* @NAME: LogInfoServiceImpl
* @USER: key
* @DATE: 2020-12-3/19:00
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Slf4j
@Service
(
"logInfoService"
)
public
class
LogInfoServiceImpl
implements
LogInfoService
{
@Resource
private
PlatformLogDao
platformLogDao
;
@Resource
private
MallCustomerDao
mallCustomerDao
;
@Override
public
Result
<
PageInfoResponse
<
PlatformLog
>>
getMallUserLogInfo
(
LogInfoQueryReq
req
)
{
Long
customerId
=
0L
;
if
(
null
==
customerId
)
{
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
}
MallCustomer
mallCustomer
=
mallCustomerDao
.
findById
(
customerId
);
if
(
null
==
mallCustomer
)
{
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
}
PageInfoResponse
<
PlatformLog
>
pageInfoResponse
=
new
PageInfoResponse
<>();
PageHelper
.
startPage
(
req
.
getPageNum
(),
req
.
getPageSize
());
List
<
PlatformLog
>
list
=
platformLogDao
.
listMallLogInfo
(
mallCustomer
.
getCustomerId
());
PageInfo
<
PlatformLog
>
pageInfo
=
new
PageInfo
<>(
list
);
pageInfoResponse
.
setCode
(
Constants
.
SUCCESS_CODE
);
pageInfoResponse
.
setMessage
(
ResultMsg
.
SUCCESS
.
getMsg
());
pageInfoResponse
.
setData
(
pageInfo
);
return
Result
.
of_success
(
pageInfoResponse
);
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
View file @
5fac08e1
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,9 +39,27 @@ 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/java/com/jz/dm/mall/moduls/service/impl/PersonalUserControllerServiceImpl.java
0 → 100644
View file @
5fac08e1
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
.
impl
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.mapper.MallCustomerDao
;
import
com.jz.dm.mall.moduls.service.PersonalUserControllerService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Date
;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service.impl
* @PROJECT_NAME: jz-dm-parent
* @NAME: PersonalUserControllerServiceImpl
* @USER: key
* @DATE: 2020-12-3/18:04
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Service
(
"personalUserControllerService"
)
@Slf4j
public
class
PersonalUserControllerServiceImpl
implements
PersonalUserControllerService
{
@Resource
private
MallCustomerDao
mallCustomerDao
;
@Override
public
Result
getUserInfo
()
{
Long
customId
=
0L
;
MallCustomer
mallCustomer
=
mallCustomerDao
.
findById
(
customId
);
if
(
null
==
mallCustomer
){
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
}
return
Result
.
of_success
(
mallCustomer
);
}
/**
* 修改用户密码
* @param oldPassWard
* @param newPassWard
* @return
*/
@Override
public
Result
updateUserPassWard
(
String
oldPassWard
,
String
newPassWard
)
{
Long
customId
=
0L
;
MallCustomer
mallCustomer
=
mallCustomerDao
.
findById
(
customId
);
if
(
null
==
mallCustomer
){
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
}
if
(!
oldPassWard
.
equals
(
mallCustomer
.
getPassword
())){
return
Result
.
of_error
(
"旧密码错误"
);
}
MallCustomer
customer
=
new
MallCustomer
();
customer
.
setCustomerId
(
mallCustomer
.
getCustomerId
());
customer
.
setPassword
(
newPassWard
);
customer
.
setUptPerson
(
mallCustomer
.
getCustomerName
());
customer
.
setUptTime
(
new
Date
());
if
(
mallCustomerDao
.
updateById
(
customer
)
!=
1
){
return
Result
.
of_error
(
ResultMsg
.
UPDATE_FAIL
);
}
return
Result
.
of_success
(
ResultMsg
.
UPDATE_SUCCESS
);
}
}
jz-dm-mall/src/main/resources/mapperconf/DepartmentDao.xml
View file @
5fac08e1
...
...
@@ -54,4 +54,19 @@
</if>
</select>
<select
id=
"selectCompanyDetail"
resultType=
"com.jz.dm.mall.moduls.controller.company.dto.CompanyInfoDto"
>
SELECT
department_id AS departmentId,
audit_status AS auditStatus,
department_name AS departmentName,
registered_address AS registeredAddress,
business_license AS businessLicense,
bank_name AS bankName,
brank_card_number AS bankCardNumber,
linkman AS linkman,
telephone AS telephone
FROM t_department
WHERE department_id=#{departmentId} AND del_flag ='N'
</select>
</mapper>
\ No newline at end of file
jz-dm-mall/src/main/resources/mapperconf/PlatformLogDao.xml
0 → 100644
View file @
5fac08e1
<?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.PlatformLogDao"
>
</mapper>
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/TestUserController.java
View file @
5fac08e1
...
...
@@ -41,7 +41,7 @@ public class TestUserController extends BaseController {
Result
<
IPage
<
User
>>
result
=
new
Result
<
IPage
<
User
>>();
IPage
<
User
>
pageList
=
testUserService
.
queryPage
(
new
Page
<
User
>(
1
,
2
),
event
);
result
.
setSuccess
(
true
);
result
.
set
Result
(
pageList
);
result
.
set
Data
(
pageList
);
return
result
;
}
...
...
@@ -51,7 +51,7 @@ public class TestUserController extends BaseController {
Result
<
IPage
<
Map
>>
result
=
new
Result
<
IPage
<
Map
>>();
IPage
<
Map
>
pageList
=
testUserService
.
queryListPage
(
new
Page
<
Map
>(
1
,
2
),
event
);
result
.
setSuccess
(
true
);
result
.
set
Result
(
pageList
);
result
.
set
Data
(
pageList
);
return
result
;
}
}
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/sys/LoginController.java
View file @
5fac08e1
...
...
@@ -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 @
5fac08e1
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 @
5fac08e1
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