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
Hide 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 {
...
@@ -10,4 +10,5 @@ public class BaseController {
public Integer getCurrentUserId(){
public Integer getCurrentUserId(){
return getCurrentUser().getUserId();
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;
...
@@ -3,4 +3,6 @@ package com.jz.common.constant;
public
interface
RedisMessageConstant
{
public
interface
RedisMessageConstant
{
static
final
String
SENDTYPE_GETPWD
=
"001"
;
//用于缓存找回密码时发送的验证码
static
final
String
SENDTYPE_GETPWD
=
"001"
;
//用于缓存找回密码时发送的验证码
static
final
String
SENDTYPE_LOGIN
=
"002"
;
// 用于缓存注册用户时发送的验证码
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
;
package
com
.
jz
.
common
.
utils
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.jz.common.constant.CommonConstant
;
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.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -16,8 +19,8 @@ import java.io.Serializable;
...
@@ -16,8 +19,8 @@ import java.io.Serializable;
*/
*/
@Data
@Data
@ApiModel
(
value
=
"接口返回对象"
,
description
=
"接口返回对象"
)
@ApiModel
(
value
=
"接口返回对象"
,
description
=
"接口返回对象"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
Result
<
T
>
implements
Serializable
{
public
class
Result
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
/**
...
@@ -30,19 +33,19 @@ public class Result<T> implements Serializable {
...
@@ -30,19 +33,19 @@ public class Result<T> implements Serializable {
* 返回处理消息
* 返回处理消息
*/
*/
@ApiModelProperty
(
value
=
"返回处理消息"
)
@ApiModelProperty
(
value
=
"返回处理消息"
)
private
String
message
=
"操作成功!"
;
private
String
message
;
/**
/**
* 返回代码
* 返回代码
*/
*/
@ApiModelProperty
(
value
=
"返回代码"
)
@ApiModelProperty
(
value
=
"返回代码"
)
private
Integer
code
=
200
;
private
Integer
code
;
/**
/**
* 返回数据对象 data
* 返回数据对象 data
*/
*/
@ApiModelProperty
(
value
=
"返回数据对象"
)
@ApiModelProperty
(
value
=
"返回数据对象"
)
private
T
result
;
private
T
data
;
/**
/**
* 时间戳
* 时间戳
...
@@ -50,66 +53,92 @@ public class Result<T> implements Serializable {
...
@@ -50,66 +53,92 @@ public class Result<T> implements Serializable {
@ApiModelProperty
(
value
=
"时间戳"
)
@ApiModelProperty
(
value
=
"时间戳"
)
private
long
timestamp
=
System
.
currentTimeMillis
();
private
long
timestamp
=
System
.
currentTimeMillis
();
public
Result
()
{
}
public
Result
<
T
>
success
(
String
message
)
{
private
Result
(
Integer
code
)
{
this
.
message
=
message
;
this
.
code
=
code
;
this
.
code
=
CommonConstant
.
SC_OK_200
;
this
.
success
=
true
;
return
this
;
}
}
/**
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
Result
setMsg
(
ResultMsg
msg
)
{
public
void
setSuccess
(
boolean
success
)
{
this
.
message
=
msg
.
getMsg
();
this
.
success
=
succes
s
;
return
thi
s
;
}
}
public
Result
setMsg
(
String
msg
)
{
public
String
getMessage
()
{
this
.
message
=
msg
;
return
message
;
return
this
;
}
}
/**
* 构造函数
*
* @param code
* 操作代码
* @param data
* 数据对象
* @param msg
* 提示消息
*/
public
void
setMessage
(
String
message
)
{
private
Result
(
Integer
code
,
T
data
,
String
msg
)
{
this
.
message
=
message
;
this
(
code
,
data
);
this
.
message
=
msg
;
}
}
public
Integer
getCode
()
{
/**new Add*/
return
code
;
public
Result
()
{
this
.
code
=
ResultCode
.
SUCCESS
.
getCode
();
}
}
public
static
Result
of_success
(
ResultMsg
msg
,
Object
data
)
{
public
void
setCode
(
Integer
code
)
{
Result
resultJson
=
new
Result
(
ResultCode
.
SUCCESS
.
getCode
(),
data
,
msg
);
this
.
code
=
code
;
return
resultJson
;
}
}
public
static
Result
of_success
(
Object
data
)
{
public
T
getResult
()
{
Result
resultJson
=
new
Result
(
ResultCode
.
SUCCESS
.
getCode
(),
data
);
return
result
;
resultJson
.
setMessage
(
ResultMsg
.
SUCCESS
.
getMsg
());
return
resultJson
;
}
}
public
static
Result
of_success
(
ResultMsg
msg
)
{
public
void
setResult
(
T
result
)
{
Result
resultJson
=
new
Result
(
ResultCode
.
SUCCESS
.
getCode
(),
null
,
msg
);
this
.
result
=
result
;
return
resultJson
;
}
}
public
static
Result
of_error
(
ResultMsg
msg
)
{
public
long
getTimestamp
()
{
Result
resultJson
=
new
Result
(
ResultCode
.
FAILURE
.
getCode
(),
null
,
msg
);
return
timestamp
;
return
resultJson
;
}
}
public
static
Result
of_error
(
Object
data
)
{
public
void
setTimestamp
(
long
timestamp
)
{
Result
resultJson
=
new
Result
(
ResultCode
.
FAILURE
.
getCode
(),
data
);
this
.
timestamp
=
timestamp
;
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
)
{
public
Result
(
boolean
success
,
String
message
)
{
this
.
success
=
success
;
this
.
success
=
success
;
this
.
message
=
message
;
this
.
message
=
message
;
}
}
public
Result
(
boolean
success
,
String
message
,
Integer
code
)
{
public
Result
(
boolean
success
,
String
message
,
Integer
code
)
{
this
.
success
=
success
;
this
.
success
=
success
;
this
.
message
=
message
;
this
.
message
=
message
;
...
@@ -120,14 +149,14 @@ public class Result<T> implements Serializable {
...
@@ -120,14 +149,14 @@ public class Result<T> implements Serializable {
this
.
success
=
success
;
this
.
success
=
success
;
this
.
message
=
message
;
this
.
message
=
message
;
this
.
code
=
code
;
this
.
code
=
code
;
this
.
result
=
result
;
this
.
data
=
result
;
}
}
public
Result
(
boolean
success
,
String
message
,
Integer
code
,
T
result
,
long
timestamp
)
{
public
Result
(
boolean
success
,
String
message
,
Integer
code
,
T
result
,
long
timestamp
)
{
this
.
success
=
success
;
this
.
success
=
success
;
this
.
message
=
message
;
this
.
message
=
message
;
this
.
code
=
code
;
this
.
code
=
code
;
this
.
result
=
result
;
this
.
data
=
result
;
this
.
timestamp
=
timestamp
;
this
.
timestamp
=
timestamp
;
}
}
...
@@ -151,7 +180,7 @@ public class Result<T> implements Serializable {
...
@@ -151,7 +180,7 @@ public class Result<T> implements Serializable {
Result
<
Object
>
r
=
new
Result
<
Object
>();
Result
<
Object
>
r
=
new
Result
<
Object
>();
r
.
setSuccess
(
true
);
r
.
setSuccess
(
true
);
r
.
setCode
(
CommonConstant
.
SC_OK_200
);
r
.
setCode
(
CommonConstant
.
SC_OK_200
);
r
.
set
Result
(
data
);
r
.
set
Data
(
data
);
return
r
;
return
r
;
}
}
...
@@ -167,11 +196,17 @@ public class Result<T> implements Serializable {
...
@@ -167,11 +196,17 @@ public class Result<T> implements Serializable {
return
r
;
return
r
;
}
}
public
Result
<
T
>
error500
(
String
message
)
{
public
Result
<
T
>
error500
(
String
message
)
{
this
.
message
=
message
;
this
.
message
=
message
;
this
.
code
=
CommonConstant
.
SC_INTERNAL_SERVER_ERROR_500
;
this
.
code
=
CommonConstant
.
SC_INTERNAL_SERVER_ERROR_500
;
this
.
success
=
false
;
this
.
success
=
false
;
return
this
;
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
;
package
com
.
jz
.
common
.
utils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
/**
/**
...
@@ -19,19 +16,16 @@ public class SessionUtils {
...
@@ -19,19 +16,16 @@ public class SessionUtils {
* @param objName 存储到session中的对象的变量名
* @param objName 存储到session中的对象的变量名
* @param o 存储的任意数据
* @param o 存储的任意数据
*/
*/
public
static
void
push
(
String
objName
,
Object
o
)
{
public
static
void
setUserCurrent
(
String
objName
,
Object
o
,
HttpServletRequest
request
)
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
request
.
getSession
().
setAttribute
(
objName
,
o
);
request
.
getSession
().
setAttribute
(
objName
,
o
);
}
}
/**
/**
* 从session中获取数据
* 从session中获取数据
* @param
objName
存储到session中的对象的变量名
* @param
key
存储到session中的对象的变量名
*/
*/
public
static
Object
pop
(
String
objName
)
{
public
static
Object
getUserCurrent
(
HttpServletRequest
request
,
String
key
){
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
return
request
.
getSession
().
getAttribute
(
key
);
return
request
.
getSession
().
getAttribute
(
objName
);
}
}
}
}
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;
...
@@ -4,6 +4,7 @@ import com.aliyuncs.http.HttpRequest;
import
com.jz.common.entity.Department
;
import
com.jz.common.entity.Department
;
import
com.jz.common.utils.Result
;
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.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.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.service.CompanyAuthService
;
import
com.jz.dm.mall.moduls.service.CompanyAuthService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -59,4 +60,24 @@ public class CompanyAuthController {
...
@@ -59,4 +60,24 @@ public class CompanyAuthController {
return
Result
.
ok
(
companyAuthService
.
selectCompany
(
type
));
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
;
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.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.common.utils.StatusCode
;
...
@@ -12,8 +13,8 @@ import org.springframework.web.bind.annotation.PostMapping;
...
@@ -12,8 +13,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet
.http.HttpServletRequest
;
import
org.apache.catalina.servlet4preview
.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
/**
/**
* @ClassName:
* @ClassName:
...
@@ -40,27 +41,24 @@ public class LoginController {
...
@@ -40,27 +41,24 @@ public class LoginController {
* @return
* @return
*/
*/
@PostMapping
(
value
=
"/login"
)
@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}$"
;
String
ph
=
"^[1][34578]\\d{9}$"
;
HttpSession
session
=
request
.
getSession
();
// 如果是手机验证
// 如果是手机验证
if
(
username
.
matches
(
username
))
{
if
(
username
.
matches
(
username
))
{
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
username
);
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
username
,
request
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerPhone
().
equals
(
username
)
&&
mallCustomer
.
getPassword
().
equals
(
password
)){
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
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
}
}
}
}
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByAccount
(
username
);
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByAccount
(
username
,
request
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerAccount
().
equals
(
username
)
&&
mallCustomer
.
getPassword
().
equals
(
password
)){
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
);
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;
...
@@ -2,6 +2,8 @@ package com.jz.dm.mall.moduls.controller.customer;
import
com.jz.common.base.BaseController
;
import
com.jz.common.base.BaseController
;
import
com.jz.common.constant.RedisMessageConstant
;
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.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.common.utils.StatusCode
;
...
@@ -32,6 +34,32 @@ public class MallCustomerController extends BaseController {
...
@@ -32,6 +34,32 @@ public class MallCustomerController extends BaseController {
@Autowired
@Autowired
private
RedisTemplate
redisTemplate
;
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;
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
;
//
//import com.aliyuncs.exceptions.ClientException;
import
com.aliyuncs.exceptions.ClientException
;
//import com.jz.common.constant.RedisMessageConstant;
import
com.jz.common.constant.RedisMessageConstant
;
//import com.jz.common.utils.Result;
import
com.jz.common.utils.Result
;
//import com.jz.common.utils.SMSUtils;
import
com.jz.common.utils.SMSUtils
;
//import com.jz.common.utils.ValidateCodeUtils;
import
com.jz.common.utils.ValidateCodeUtils
;
//import io.swagger.annotations.Api;
import
io.swagger.annotations.Api
;
//import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Autowired
;
//import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.data.redis.core.RedisTemplate
;
//import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.util.StringUtils
;
//import org.springframework.web.bind.annotation.RestController;
import
org.springframework.web.bind.annotation.PostMapping
;
//import redis.clients.jedis.Jedis;
import
org.springframework.web.bind.annotation.RequestMapping
;
//import redis.clients.jedis.JedisPool;
import
org.springframework.web.bind.annotation.RestController
;
//
///**
// * @ClassName: 短信发送接口
import
java.util.concurrent.TimeUnit
;
// * @Author: Carl
// * @Date: 2020/12/2
/**
// * @Version:
* @ClassName: 短信发送接口
// */
* @Author: Carl
//@RestController
* @Date: 2020/12/2
//@RequestMapping("/validateCode")
* @Version:
//@Api(tags = "短信发送api")
*/
//public class ValidateCodeController {
@RestController
//
@RequestMapping
(
"/validateCode"
)
// //@Autowired
@Api
(
tags
=
"短信发送api"
)
// //private JedisPool jedisPool;
public
class
ValidateCodeController
{
//
// /**
@Autowired
// * 注册时发送的验证码
private
RedisTemplate
redisTemplate
;
// * @param telephone
// * @return
/**
// */
* 注册时发送的验证码
// @PostMapping("/send4Login")
* @param telephone
// public Result send4Login(String telephone) {
* @return
// // 查询redis里是否存在该手机号
*/
// Jedis jedis = jedisPool.getResource();
@PostMapping
(
value
=
"/sendForLogin"
)
// String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
public
Result
sendForLogin
(
String
telephone
)
{
// String codeInRedis = jedis.get(key);
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
// if (codeInRedis != null && !codeInRedis.equals("")) {
// 通过手机号从redis获取验证码
// // redis中的数据还未过期
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
// return new Result(false, "验证码已发送,请注意查收!");
// }else {
if
(!
StringUtils
.
isEmpty
(
codeInRedis
))
{
// Integer code = ValidateCodeUtils.generateValidateCode(6);
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
);
// try {
}
else
{
// SMSUtils.sendShortMessage(SMSUtils.VALIDATE_CODE, telephone, code.toString());
// 生成验证码
// } catch (Exception e) {
String
code
=
ValidateCodeUtils
.
generateValidateCode
(
6
)
+
""
;
// e.printStackTrace();
// 发送
// }
try
{
// jedis.setex(key,5*60,code+"");
SMSUtils
.
sendShortMessage
(
SMSUtils
.
VALIDATE_CODE
,
telephone
,
code
);
// return new Result(true, "验证码发送成功!");
}
catch
(
ClientException
e
)
{
// }
e
.
printStackTrace
();
// }
return
new
Result
(
false
,
"验证码发送失败!"
);
//
}
// /**
// 存入redis, 有效期为5分钟
// * 修改密码发送验证码
redisTemplate
.
opsForValue
().
set
(
key
,
code
,
5
,
TimeUnit
.
MINUTES
);
// * @param telephone
return
new
Result
(
true
,
"验证码发送成功!"
);
// * @return
}
// */
}
// @PostMapping("/send4Code")
// public Result send4Code(String telephone) {
// // 查询redis里是否存在该手机号
/**
// Jedis jedis = jedisPool.getResource();
* 修改密码发送验证码
// String key = RedisMessageConstant.SENDTYPE_GETPWD + "_" + telephone;
* @param telephone
// String codeInRedis = jedis.get(key);
* @return
// if (codeInRedis != null && !codeInRedis.equals("")) {
*/
// // redis中的数据还未过期
@PostMapping
(
"/send4Code"
)
// return new Result(false, "验证码已发送,请注意查收!");
public
Result
send4Code
(
String
telephone
)
{
// }else {
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
// Integer code = ValidateCodeUtils.generateValidateCode(6);
// 通过手机号从redis获取验证码
// try {
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
// SMSUtils.sendShortMessage(SMSUtils.VALIDATE_CODE, telephone, code.toString());
// } catch (Exception e) {
if
(!
StringUtils
.
isEmpty
(
codeInRedis
))
{
// e.printStackTrace();
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
);
// }
}
else
{
// jedis.setex(key,5*60,code+"");
// 生成验证码
// return new Result(true, "验证码发送成功!");
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 {
...
@@ -64,7 +64,7 @@ public class OrderController {
Result
<
OrderDto
>
result
=
new
Result
<
OrderDto
>();
Result
<
OrderDto
>
result
=
new
Result
<
OrderDto
>();
if
(
StringUtils
.
isNotEmpty
(
orderId
))
{
if
(
StringUtils
.
isNotEmpty
(
orderId
))
{
OrderDto
orderDto
=
orderService
.
getOrderDetail
(
orderId
);
OrderDto
orderDto
=
orderService
.
getOrderDetail
(
orderId
);
result
.
set
Result
(
orderDto
);
result
.
set
Data
(
orderDto
);
}
else
{
}
else
{
result
.
setMessage
(
"参数为不能为空!"
);
result
.
setMessage
(
"参数为不能为空!"
);
}
}
...
@@ -91,7 +91,7 @@ public class OrderController {
...
@@ -91,7 +91,7 @@ public class OrderController {
}
}
//查询接口文档 和参数信息
//查询接口文档 和参数信息
Map
dataGoodsApi
=
orderService
.
getApiInterfaceDetail
(
params
);
Map
dataGoodsApi
=
orderService
.
getApiInterfaceDetail
(
params
);
result
.
set
Result
(
dataGoodsApi
);
result
.
set
Data
(
dataGoodsApi
);
return
result
;
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 {
...
@@ -75,12 +75,24 @@ public class MallCustomer implements Serializable {
* 更新时间
* 更新时间
*/
*/
private
Date
uptTime
;
private
Date
uptTime
;
/**
* 更新人
*/
private
String
uptPerson
;
/**
/**
* 删除标识:Y是,N否
* 删除标识:Y是,N否
*/
*/
private
String
delFlag
;
private
String
delFlag
;
public
String
getUptPerson
()
{
return
uptPerson
;
}
public
void
setUptPerson
(
String
uptPerson
)
{
this
.
uptPerson
=
uptPerson
;
}
public
Long
getCustomerId
()
{
public
Long
getCustomerId
()
{
return
customerId
;
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;
...
@@ -3,6 +3,10 @@ package com.jz.dm.mall.moduls.mapper;
import
com.jz.common.base.BaseMapper
;
import
com.jz.common.base.BaseMapper
;
import
com.jz.common.entity.Department
;
import
com.jz.common.entity.Department
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
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)表数据库访问层
* 企业(TDepartment)表数据库访问层
...
@@ -18,4 +22,20 @@ public interface DepartmentDao extends BaseMapper<Department> {
...
@@ -18,4 +22,20 @@ public interface DepartmentDao extends BaseMapper<Department> {
* @return
* @return
*/
*/
Department
selectDepartmentData
(
CompanyAddReq
req
);
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;
...
@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.mapper;
import
com.jz.common.base.BaseMapper
;
import
com.jz.common.base.BaseMapper
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
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.ResultType
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Select
;
...
@@ -29,6 +30,10 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
...
@@ -29,6 +30,10 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
*/
*/
MallCustomer
selectByPhone
(
String
username
);
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查询用户信息
* 根据ID查询用户信息
* @param customerId
* @param customerId
...
@@ -37,4 +42,5 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
...
@@ -37,4 +42,5 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
@Select
(
"select * from t_mall_customer where customer_id =#{customerId}"
)
@Select
(
"select * from t_mall_customer where customer_id =#{customerId}"
)
@ResultType
(
MallCustomer
.
class
)
@ResultType
(
MallCustomer
.
class
)
MallCustomer
findById
(
Long
customerId
);
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;
...
@@ -3,6 +3,7 @@ package com.jz.dm.mall.moduls.service;
import
com.jz.common.entity.Department
;
import
com.jz.common.entity.Department
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyUpdateReq
;
/**
/**
* @author ZC
* @author ZC
...
@@ -27,7 +28,20 @@ public interface CompanyAuthService {
...
@@ -27,7 +28,20 @@ public interface CompanyAuthService {
* @param type
* @param type
* @return
* @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;
...
@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.service;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -17,14 +18,18 @@ public interface MallCustomerService {
...
@@ -17,14 +18,18 @@ public interface MallCustomerService {
* @param username
* @param username
* @return
* @return
*/
*/
MallCustomer
selectByAccount
(
String
username
);
MallCustomer
selectByAccount
(
String
username
,
HttpServletRequest
request
);
/**
/**
* 通过手机号进行查询
* 通过手机号进行查询
* @param username
* @param username
* @return
* @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
;
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.entity.Department
;
import
com.jz.common.exception.ResponseException
;
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.FinanceCustomerAssets
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
...
@@ -40,6 +44,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
...
@@ -40,6 +44,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
private
FinanceCustomerAssetsDao
financeCustomerAssetsDao
;
private
FinanceCustomerAssetsDao
financeCustomerAssetsDao
;
@Resource
@Resource
private
MallCustomerDao
mallCustomerDao
;
private
MallCustomerDao
mallCustomerDao
;
/**
/**
* 添加企业认证
* 添加企业认证
*
*
...
@@ -47,54 +52,123 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
...
@@ -47,54 +52,123 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
* @return
* @return
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Result
addCompanyData
(
CompanyAddReq
req
)
{
public
Result
addCompanyData
(
CompanyAddReq
req
)
{
//TODO 获取当前用户ID判断当前用户是否已经关联企业
//TODO 获取当前用户ID判断当前用户是否已经关联企业
// Long customerId = (Long) UserContextUtil.pop("customer_id");
// Long customerId = (Long) UserContextUtil.pop("customer_id");
Long
customerId
=
0L
;
Long
customerId
=
0L
;
if
(
null
==
customerId
)
{
if
(
null
==
customerId
)
{
return
Result
.
error
(
"获取用户信息失败"
);
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
}
}
MallCustomer
mallCustomer
=
mallCustomerDao
.
findById
(
customerId
);
MallCustomer
mallCustomer
=
mallCustomerDao
.
findById
(
customerId
);
if
(
null
==
mallCustomer
){
if
(
null
==
mallCustomer
)
{
return
Result
.
error
(
"用户信息不存在"
);
return
Result
.
of_error
(
ResultMsg
.
USER_NOT_EXIST
);
}
}
if
(
null
!=
mallCustomer
.
getDepartmentId
()){
if
(
null
!=
mallCustomer
.
getDepartmentId
())
{
return
Result
.
error
(
"用户已关联企业,请勿重复操作"
);
return
Result
.
of_
error
(
"用户已关联企业,请勿重复操作"
);
}
}
req
.
setCustomerId
(
mallCustomer
.
getCustomerId
());
req
.
setCustomerId
(
mallCustomer
.
getCustomerId
());
if
(
StringUtils
.
isNotBlank
(
req
.
getDepartmentName
())
&&
if
(
StringUtils
.
isNotBlank
(
req
.
getDepartmentName
())
&&
StringUtils
.
isNotBlank
(
req
.
getUnifiedCreditCode
()))
{
//企业名称 && 营业执照
StringUtils
.
isNotBlank
(
req
.
getUnifiedCreditCode
()))
{
//企业名称 && 营业执照
Department
department
=
departmentDao
.
selectDepartmentData
(
req
);
Department
department
=
departmentDao
.
selectDepartmentData
(
req
);
if
(
null
!=
department
)
{
if
(
null
!=
department
)
{
return
Result
.
error
(
"企业用户信息已存在"
);
return
Result
.
of_
error
(
"企业用户信息已存在"
);
}
}
}
}
insetCompany
(
req
);
insetCompany
(
req
);
return
Result
.
o
k
(
"添加企业用户成功"
);
return
Result
.
o
f_success
(
ResultMsg
.
SUCCESS
);
}
}
/**
/**
* 查询企业认证详情
* 查询企业认证详情
*
* @param type
* @param type
* @return
* @return
*/
*/
@Override
@Override
public
Result
<
Department
>
selectCompany
(
String
type
)
{
public
Result
selectCompany
(
String
type
)
{
//查询用户判断用户是否认证
// TODO 查询用户判断用户是否认证
// Long customerId = (Long) UserContextUtil.pop("customer_id");
MallCustomer
currentUser
=
getCurrentUser
(
0L
);
// if (null ==customerId){
if
(
null
==
currentUser
)
{
// return Result.error("获取用户信息失败");
return
Result
.
error
(
"当前用户信息不存在"
);
// }
}
// MallCustomer mallCustomer = mallCustomerDao.findById(customerId);
if
(
StringUtils
.
equals
(
type
,
"STATUS"
))
{
//状态
// if (null == mallCustomer){
String
auditStatus
=
departmentDao
.
selectCompanyStatus
(
currentUser
.
getDepartmentId
());
// return Result.error("用户信息不存在");
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
;
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
* @param req
*/
*/
private
void
insetCompany
(
CompanyAddReq
req
)
{
private
void
insetCompany
(
CompanyAddReq
req
)
{
...
@@ -103,8 +177,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
...
@@ -103,8 +177,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
departmentInset
.
setAuditStatus
(
"01"
);
//待审核
departmentInset
.
setAuditStatus
(
"01"
);
//待审核
departmentInset
.
setCreTime
(
new
Date
());
departmentInset
.
setCreTime
(
new
Date
());
departmentInset
.
setCrePerson
(
req
.
getLoginName
());
departmentInset
.
setCrePerson
(
req
.
getLoginName
());
BeanUtils
.
copyProperties
(
req
,
departmentInset
);
BeanUtils
.
copyProperties
(
req
,
departmentInset
);
if
(
departmentDao
.
insert
(
departmentInset
)
!=
1
){
if
(
departmentDao
.
insert
(
departmentInset
)
!=
1
)
{
throw
ResponseException
.
of_error
(
"保存企业信息失败"
);
throw
ResponseException
.
of_error
(
"保存企业信息失败"
);
}
}
//初始化用户资产表
//初始化用户资产表
...
@@ -112,7 +186,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
...
@@ -112,7 +186,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
finance
.
setDepartmentId
(
departmentInset
.
getDepartmentId
());
//企业ID
finance
.
setDepartmentId
(
departmentInset
.
getDepartmentId
());
//企业ID
finance
.
setCreTime
(
new
Date
());
finance
.
setCreTime
(
new
Date
());
finance
.
setCrePerson
(
req
.
getLoginName
());
finance
.
setCrePerson
(
req
.
getLoginName
());
if
(
financeCustomerAssetsDao
.
insert
(
finance
)
!=
1
){
if
(
financeCustomerAssetsDao
.
insert
(
finance
)
!=
1
)
{
throw
ResponseException
.
of_error
(
"初始化用户资产失败"
);
throw
ResponseException
.
of_error
(
"初始化用户资产失败"
);
}
}
//更新用户企业信息
//更新用户企业信息
...
@@ -120,8 +194,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
...
@@ -120,8 +194,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
mallCustomer
.
setCustomerId
(
req
.
getCustomerId
());
//用户ID
mallCustomer
.
setCustomerId
(
req
.
getCustomerId
());
//用户ID
mallCustomer
.
setDepartmentId
(
departmentInset
.
getDepartmentId
());
mallCustomer
.
setDepartmentId
(
departmentInset
.
getDepartmentId
());
mallCustomer
.
setUptTime
(
new
Date
());
mallCustomer
.
setUptTime
(
new
Date
());
//
mallCustomer.setUptPerson(req.getLoginName());
mallCustomer
.
setUptPerson
(
req
.
getLoginName
());
if
(
mallCustomerDao
.
updateById
(
mallCustomer
)
!=
1
){
if
(
mallCustomerDao
.
updateById
(
mallCustomer
)
!=
1
)
{
throw
ResponseException
.
of_error
(
"更新用户企业信息失败"
);
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
;
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.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.mapper.MallCustomerDao
;
import
com.jz.dm.mall.moduls.mapper.MallCustomerDao
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* 商城用户(TMallCustomer)表服务实现类
* 商城用户(TMallCustomer)表服务实现类
*
*
...
@@ -18,6 +29,9 @@ public class MallCustomerServiceImpl implements MallCustomerService {
...
@@ -18,6 +29,9 @@ public class MallCustomerServiceImpl implements MallCustomerService {
@Autowired
@Autowired
private
MallCustomerDao
tMallCustomerDao
;
private
MallCustomerDao
tMallCustomerDao
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
/**
* 通过用户账号进行查询
* 通过用户账号进行查询
*
*
...
@@ -25,10 +39,28 @@ public class MallCustomerServiceImpl implements MallCustomerService {
...
@@ -25,10 +39,28 @@ public class MallCustomerServiceImpl implements MallCustomerService {
* @return
* @return
*/
*/
@Override
@Override
public
MallCustomer
selectByAccount
(
String
username
)
{
public
MallCustomer
selectByAccount
(
String
username
,
HttpServletRequest
request
)
{
return
tMallCustomerDao
.
selectByAccount
(
username
);
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 {
...
@@ -36,9 +68,46 @@ public class MallCustomerServiceImpl implements MallCustomerService {
* @return
* @return
*/
*/
@Override
@Override
public
MallCustomer
selectByPhone
(
String
username
)
{
public
MallCustomer
selectByPhone
(
String
username
,
HttpServletRequest
request
)
{
return
tMallCustomerDao
.
selectByPhone
(
username
);
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 @@
...
@@ -54,4 +54,19 @@
</if>
</if>
</select>
</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>
</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 {
...
@@ -41,7 +41,7 @@ public class TestUserController extends BaseController {
Result
<
IPage
<
User
>>
result
=
new
Result
<
IPage
<
User
>>();
Result
<
IPage
<
User
>>
result
=
new
Result
<
IPage
<
User
>>();
IPage
<
User
>
pageList
=
testUserService
.
queryPage
(
new
Page
<
User
>(
1
,
2
),
event
);
IPage
<
User
>
pageList
=
testUserService
.
queryPage
(
new
Page
<
User
>(
1
,
2
),
event
);
result
.
setSuccess
(
true
);
result
.
setSuccess
(
true
);
result
.
set
Result
(
pageList
);
result
.
set
Data
(
pageList
);
return
result
;
return
result
;
}
}
...
@@ -51,7 +51,7 @@ public class TestUserController extends BaseController {
...
@@ -51,7 +51,7 @@ public class TestUserController extends BaseController {
Result
<
IPage
<
Map
>>
result
=
new
Result
<
IPage
<
Map
>>();
Result
<
IPage
<
Map
>>
result
=
new
Result
<
IPage
<
Map
>>();
IPage
<
Map
>
pageList
=
testUserService
.
queryListPage
(
new
Page
<
Map
>(
1
,
2
),
event
);
IPage
<
Map
>
pageList
=
testUserService
.
queryListPage
(
new
Page
<
Map
>(
1
,
2
),
event
);
result
.
setSuccess
(
true
);
result
.
setSuccess
(
true
);
result
.
set
Result
(
pageList
);
result
.
set
Data
(
pageList
);
return
result
;
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;
...
@@ -3,6 +3,7 @@ package com.jz.manage.moduls.controller.sys;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.entity.SysUser
;
import
com.jz.common.entity.SysUser
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.manage.moduls.controller.BaseController
;
import
com.jz.manage.moduls.controller.BaseController
;
import
com.jz.manage.moduls.service.SysUserService
;
import
com.jz.manage.moduls.service.SysUserService
;
...
@@ -38,14 +39,12 @@ public class LoginController extends BaseController {
...
@@ -38,14 +39,12 @@ public class LoginController extends BaseController {
public
Result
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
{
public
Result
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
{
// 手机
// 手机
String
ph
=
"^[1][34578]\\d{9}$"
;
String
ph
=
"^[1][34578]\\d{9}$"
;
HttpSession
session
=
request
.
getSession
();
// 如果是手机验证
// 如果是手机验证
if
(
username
.
matches
(
username
))
{
if
(
username
.
matches
(
username
))
{
SysUser
sysUser
=
sysUserService
.
selectByPhone
(
username
);
SysUser
sysUser
=
sysUserService
.
selectByPhone
(
username
);
if
(
sysUser
!=
null
)
{
if
(
sysUser
!=
null
)
{
if
(
sysUser
.
getTelephone
().
equals
(
username
)
&&
sysUser
.
getPassword
().
equals
(
password
)){
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
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
...
@@ -54,8 +53,6 @@ public class LoginController extends BaseController {
...
@@ -54,8 +53,6 @@ public class LoginController extends BaseController {
SysUser
sysUser
=
sysUserService
.
selectByUsername
(
username
);
SysUser
sysUser
=
sysUserService
.
selectByUsername
(
username
);
if
(
sysUser
!=
null
)
{
if
(
sysUser
!=
null
)
{
if
(
sysUser
.
getAccount
().
equals
(
username
)
&&
sysUser
.
getPassword
().
equals
(
password
)){
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
);
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
}
}
}
...
@@ -64,7 +61,6 @@ public class LoginController extends BaseController {
...
@@ -64,7 +61,6 @@ public class LoginController extends BaseController {
/**
/**
* 手机号码校验
* 手机号码校验
* @param paramMap
* @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
;
package
com
.
jz
.
manage
.
moduls
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.entity.SysUser
;
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.mapper.SysUserDao
;
import
com.jz.manage.moduls.service.SysUserService
;
import
com.jz.manage.moduls.service.SysUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* 平台系统用户表(SysUser)表服务实现类
* 平台系统用户表(SysUser)表服务实现类
...
@@ -23,19 +29,50 @@ public class SysUserServiceImpl implements SysUserService {
...
@@ -23,19 +29,50 @@ public class SysUserServiceImpl implements SysUserService {
@Autowired
@Autowired
private
SysUserDao
sysUserDao
;
private
SysUserDao
sysUserDao
;
@Autowired
private
RedisTemplate
redisTemplate
;
@Override
@Override
public
SysUser
selectByUsername
(
String
account
)
{
public
SysUser
selectByUsername
(
String
username
)
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"account"
,
account
);
queryWrapper
.
eq
(
"account"
,
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
@Override
public
SysUser
selectByPhone
(
String
username
)
{
public
SysUser
selectByPhone
(
String
username
)
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"telephone"
,
username
);
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
@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