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
48d7fc7f
Commit
48d7fc7f
authored
Dec 21, 2020
by
zhangc
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm_dev' of
http://gitlab.ioubuy.cn/yaobenzhang/dm_project
into dm_dev
parents
2695da52
d8591742
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
274 additions
and
125 deletions
+274
-125
update.sql
database/qys/update.sql
+2
-1
SMSUtils.java
jz-dm-common/src/main/java/com/jz/common/utils/SMSUtils.java
+43
-45
StatusCode.java
...-common/src/main/java/com/jz/common/utils/StatusCode.java
+2
-2
LoginController.java
...z/dm/mall/moduls/controller/customer/LoginController.java
+20
-17
MallCustomerController.java
...ll/moduls/controller/customer/MallCustomerController.java
+19
-19
PersonalUserController.java
...ll/moduls/controller/customer/PersonalUserController.java
+1
-1
ValidateCodeController.java
...ll/moduls/controller/customer/ValidateCodeController.java
+15
-9
CustomerDto.java
.../dm/mall/moduls/controller/customer/bean/CustomerDto.java
+19
-0
CustomerRequest.java
.../moduls/controller/customer/bean/req/CustomerRequest.java
+59
-0
LoginRequest.java
...all/moduls/controller/customer/bean/req/LoginRequest.java
+46
-0
DataGoodsApiController.java
.../mall/moduls/controller/goods/DataGoodsApiController.java
+2
-2
DataGoodsController.java
.../dm/mall/moduls/controller/goods/DataGoodsController.java
+2
-0
MallHotRecommendGoodsController.java
...uls/controller/goods/MallHotRecommendGoodsController.java
+1
-1
OrderController.java
...m/jz/dm/mall/moduls/controller/order/OrderController.java
+1
-1
MallCustomerService.java
...va/com/jz/dm/mall/moduls/service/MallCustomerService.java
+3
-2
MallCustomerServiceImpl.java
.../dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
+7
-6
MallCustomerDao.xml
jz-dm-mall/src/main/resources/mapperconf/MallCustomerDao.xml
+2
-0
DepartmentController.java
...nage/moduls/controller/customer/DepartmentController.java
+11
-4
DataGoodsApiController.java
...anage/moduls/controller/goods/DataGoodsApiController.java
+1
-1
DepartmentService.java
.../java/com/jz/manage/moduls/service/DepartmentService.java
+2
-2
DepartmentServiceImpl.java
.../jz/manage/moduls/service/impl/DepartmentServiceImpl.java
+16
-12
No files found.
database/qys/update.sql
View file @
48d7fc7f
alter
table
t_data_goods
add
use_person
varchar
(
64
)
DEFAULT
'0'
COMMENT
'使用人数'
;
alter
table
t_data_goods
add
use_person
varchar
(
64
)
DEFAULT
'0'
COMMENT
'使用人数'
;
alter
table
t_mall_customer
add
head_portrait_url
varchar
(
512
)
COMMENT
'头像'
;
\ No newline at end of file
jz-dm-common/src/main/java/com/jz/common/utils/SMSUtils.java
View file @
48d7fc7f
...
@@ -16,65 +16,63 @@ import com.aliyuncs.profile.IClientProfile;
...
@@ -16,65 +16,63 @@ import com.aliyuncs.profile.IClientProfile;
* @Version:
* @Version:
*/
*/
public
class
SMSUtils
{
public
class
SMSUtils
{
public
static
final
String
VALIDATE_CODE
=
"SMS_
198677589"
;
//发送短信验证码 验证码签名, 改成你的
public
static
final
String
VALIDATE_CODE
=
"SMS_
205878938"
;
//发送短信验证码模板编码 模版CODE
public
static
final
String
ORDER_NOTICE
=
"SMS_159771588"
;
//
成功通知, 通知类的模板(需要通用的签名)
public
static
final
String
ORDER_NOTICE
=
"SMS_159771588"
;
//
体检预约成功通知
private
static
final
String
SIGN_NAEM
=
"
ysongq
商城"
;
// 短信的签名
private
static
final
String
SIGN_NAEM
=
"
万家数据
商城"
;
// 短信的签名
private
static
final
String
PARAMETER_NAME
=
"code"
;
// 短信模板内容中的参数名
private
static
final
String
PARAMETER_NAME
=
"code"
;
private
static
final
String
ACCESS_KEY
=
"LTAI4G
AnKS1Gj2NwDepvyBuB"
;
//
AccessKey ID
private
static
final
String
ACCESS_KEY
=
"LTAI4G
KPoTkrT6n2fSV7ePEG"
;
//你的
AccessKey ID
private
static
final
String
SECRET_KEY
=
"
BIHOQP6muPtCz9YzrSQpSj0dJjZIET"
;
//
AccessKey Secret
private
static
final
String
SECRET_KEY
=
"
k8HcW3TxZzGxAetEpyDInZehip9MAE"
;
//你的
AccessKey Secret
public
static
void
main
(
String
[]
args
)
throws
ClientException
{
public
static
void
main
(
String
[]
args
)
throws
ClientException
{
SMSUtils
.
sendShortMessage
(
"VALIDATE_CODE"
,
"18279617424"
,
"666666
"
);
SMSUtils
.
sendShortMessage
(
VALIDATE_CODE
,
"19979232865"
,
"55555555
"
);
}
}
/**
/**
*
发送短信
*
* @param templateCode
验证码的模板code
* @param templateCode
* @param phoneNumbers
接收的手机号码
* @param phoneNumbers
* @param param
验证码
* @param param
* @throws ClientException
* @throws ClientException
*/
*/
public
static
void
sendShortMessage
(
String
templateCode
,
String
phoneNumbers
,
String
param
)
throws
ClientException
{
public
static
void
sendShortMessage
(
String
templateCode
,
String
phoneNumbers
,
String
param
)
throws
ClientException
{
//设置超时时间-可自行调整
//
设置超时时间-可自行调整
System
.
setProperty
(
"sun.net.client.defaultConnectTimeout"
,
"10000"
);
System
.
setProperty
(
"sun.net.client.defaultConnectTimeout"
,
"10000"
);
System
.
setProperty
(
"sun.net.client.defaultReadTimeout"
,
"10000"
);
System
.
setProperty
(
"sun.net.client.defaultReadTimeout"
,
"10000"
);
//初始化ascClient需要的几个参数
// 初始化ascClient需要的几个参数
final
String
product
=
"Dysmsapi"
;
//短信API产品名称(短信产品名固定,无需修改)
final
String
product
=
"Dysmsapi"
;
// 短信API产品名称(短信产品名固定,无需修改)
final
String
domain
=
"dysmsapi.aliyuncs.com"
;
//短信API产品域名(接口地址固定,无需修改)
final
String
domain
=
"dysmsapi.aliyuncs.com"
;
// 短信API产品域名(接口地址固定,无需修改)
//替换成你的AK
// 替换成你的AK
final
String
accessKeyId
=
ACCESS_KEY
;
//你的accessKeyId,参考本文档步骤2
final
String
accessKeyId
=
"LTAIak3CfAehK7cE"
;
// 你的accessKeyId,参考本文档步骤2
final
String
accessKeySecret
=
SECRET_KEY
;
//你的accessKeySecret,参考本文档步骤2
final
String
accessKeySecret
=
"zsykwhTIFa48f8fFdU06GOKjHWHel4"
;
// 你的accessKeySecret,参考本文档步骤2
//初始化ascClient,暂时不支持多region(请勿修改)
// 初始化ascClient,暂时不支持多region(请勿修改)
IClientProfile
profile
=
DefaultProfile
.
getProfile
(
"cn-hangzhou"
,
accessKeyId
,
IClientProfile
profile
=
DefaultProfile
.
getProfile
(
"cn-hangzhou"
,
ACCESS_KEY
,
SECRET_KEY
);
accessKeySecret
);
DefaultProfile
.
addEndpoint
(
"cn-hangzhou"
,
"cn-hangzhou"
,
product
,
domain
);
DefaultProfile
.
addEndpoint
(
"cn-hangzhou"
,
"cn-hangzhou"
,
product
,
domain
);
IAcsClient
acsClient
=
new
DefaultAcsClient
(
profile
);
IAcsClient
acsClient
=
new
DefaultAcsClient
(
profile
);
// 组装请求对象
//组装请求对象
SendSmsRequest
request
=
new
SendSmsRequest
();
SendSmsRequest
request
=
new
SendSmsRequest
();
//使用post提交
//
使用post提交
request
.
setMethod
(
MethodType
.
POST
);
request
.
setMethod
(
MethodType
.
POST
);
//必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式;发送国际/港澳台消息时,接收号码格式为国际区号+号码,如“85200000000”
// 必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
request
.
setPhoneNumbers
(
"1500000000"
);
request
.
setPhoneNumbers
(
phoneNumbers
);
//必填:短信签名-可在短信控制台中找到
// 必填:短信签名-可在短信控制台中找到
request
.
setSignName
(
"云通信"
);
request
.
setSignName
(
SIGN_NAEM
);
//必填:短信模板-可在短信控制台中找到,发送国际/港澳台消息时,请使用国际/港澳台短信模版
// 必填:短信模板-可在短信控制台中找到
request
.
setTemplateCode
(
"SMS_1000000"
);
request
.
setTemplateCode
(
templateCode
);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
// 可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
//友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
// 友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
//参考:request.setTemplateParam("{\"变量1\":\"值1\",\"变量2\":\"值2\",\"变量3\":\"值3\"}")
//request.setTemplateParam("{\"code\":\""+param+"\"}");
request
.
setTemplateParam
(
"{\"name\":\"Tom\", \"code\":\"123\"}"
);
request
.
setTemplateParam
(
String
.
format
(
"{\"%s\":\"%s\"}"
,
PARAMETER_NAME
,
param
));
//可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
// 可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
//request.setSmsUpExtendCode("90997");
// request.setSmsUpExtendCode("90997");
// 可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
// request.setOutId("yourOutId");
request
.
setOutId
(
"yourOutId"
);
// 请求失败这里会抛ClientException异常
//请求失败这里会抛ClientException异常
SendSmsResponse
sendSmsResponse
=
acsClient
.
getAcsResponse
(
request
);
SendSmsResponse
sendSmsResponse
=
acsClient
.
getAcsResponse
(
request
);
if
(
sendSmsResponse
.
getCode
()
!=
null
&&
sendSmsResponse
.
getCode
().
equals
(
"OK"
))
{
if
(
sendSmsResponse
.
getCode
()
!=
null
&&
sendSmsResponse
.
getCode
().
equals
(
"OK"
))
{
//请求成功
// 请求成功
System
.
out
.
println
(
"请求成功"
);
}
else
{
System
.
out
.
println
(
sendSmsResponse
.
getMessage
());
}
}
}
}
}
}
jz-dm-common/src/main/java/com/jz/common/utils/StatusCode.java
View file @
48d7fc7f
...
@@ -9,6 +9,6 @@ package com.jz.common.utils;
...
@@ -9,6 +9,6 @@ package com.jz.common.utils;
public
class
StatusCode
{
public
class
StatusCode
{
public
static
final
int
OK
=
200
;
// 成功
public
static
final
int
OK
=
200
;
// 成功
public
static
final
int
ERROR
=
201
;
// 失败
public
static
final
int
ERROR
=
201
;
// 失败
public
static
final
int
LOGINERROR
=
30
002
;
// 用户名或密码错误
public
static
final
int
LOGINERROR
=
30
1
;
// 用户名或密码错误
public
static
final
int
ACCESSERROR
=
30
003
;
// 权限不足
public
static
final
int
ACCESSERROR
=
30
2
;
// 权限不足
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/LoginController.java
View file @
48d7fc7f
...
@@ -7,9 +7,12 @@ import com.jz.common.utils.Result;
...
@@ -7,9 +7,12 @@ import com.jz.common.utils.Result;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest
;
import
com.jz.dm.mall.moduls.controller.customer.bean.req.LoginRequest
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.catalina.servlet4preview.http.HttpServletRequest
;
import
org.apache.catalina.servlet4preview.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -28,7 +31,7 @@ import java.util.Map;
...
@@ -28,7 +31,7 @@ import java.util.Map;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/customer"
)
@RequestMapping
(
"/customer"
)
@Api
(
tags
=
"商城登陆
api
"
)
@Api
(
tags
=
"商城登陆
--controller
"
)
public
class
LoginController
{
public
class
LoginController
{
/**
/**
* 服务对象
* 服务对象
...
@@ -42,14 +45,13 @@ public class LoginController {
...
@@ -42,14 +45,13 @@ public class LoginController {
/**
/**
* 登录功能
* 登录功能
*
*
* @param username 账号
* @param password 密码
* @return
* @return
*/
*/
@PostMapping
(
value
=
"/login"
)
@PostMapping
(
value
=
"/login"
)
@ApiOperation
(
value
=
"登录功能"
,
notes
=
"登录功能"
)
@ApiOperation
(
value
=
"登录功能"
,
notes
=
"登录功能"
)
public
Result
<
CustomerDto
>
login
(
@RequestParam
(
value
=
"username"
)
String
username
,
public
Result
<
CustomerDto
>
login
(
@RequestBody
LoginRequest
customer
,
HttpServletRequest
request
)
throws
Exception
{
@RequestParam
(
value
=
"password"
)
String
password
,
HttpServletRequest
request
)
throws
Exception
{
String
username
=
customer
.
getUsername
();
String
password
=
customer
.
getPassword
();
// 手机
// 手机
String
ph
=
"^[1][34578]\\d{9}$"
;
String
ph
=
"^[1][34578]\\d{9}$"
;
// 如果是手机验证
// 如果是手机验证
...
@@ -58,7 +60,7 @@ public class LoginController {
...
@@ -58,7 +60,7 @@ public class LoginController {
request
.
getSession
().
getAttribute
(
"mallCustomer"
);
request
.
getSession
().
getAttribute
(
"mallCustomer"
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerPhone
().
equals
(
username
)
&&
mallCustomer
.
getPassword
().
equals
(
password
))
{
if
(
mallCustomer
.
getCustomerPhone
().
equals
(
username
)
&&
mallCustomer
.
getPassword
().
equals
(
password
))
{
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
,
mallCustomer
);
}
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
}
}
...
@@ -66,7 +68,7 @@ public class LoginController {
...
@@ -66,7 +68,7 @@ public class LoginController {
CustomerDto
mallCustomer
=
mallCustomerService
.
selectByAccount
(
username
,
request
);
CustomerDto
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
))
{
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
,
mallCustomer
);
}
}
}
}
...
@@ -76,13 +78,14 @@ public class LoginController {
...
@@ -76,13 +78,14 @@ public class LoginController {
/**
/**
* 手机获取验证码
* 手机获取验证码
*
*
* @param
paramMap
* @param
* @return
* @return
*/
*/
@PostMapping
(
value
=
"/getCode"
)
@PostMapping
(
value
=
"/getCode"
)
public
Result
loginCheck
(
@RequestParam
(
required
=
true
)
Map
<
String
,
String
>
paramMap
)
{
@ApiOperation
(
"通过手机号码获取验证码"
)
public
Result
loginCheck
(
@RequestParam
(
value
=
"telephone"
)
String
telephone
,
@RequestParam
(
value
=
"validateCode"
)
String
validateCode
)
{
// 获取手机号码
// 获取手机号码
String
telephone
=
paramMap
.
get
(
"telephone"
);
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
// 获取redis中key对应的值
// 获取redis中key对应的值
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
...
@@ -90,7 +93,7 @@ public class LoginController {
...
@@ -90,7 +93,7 @@ public class LoginController {
return
new
Result
(
false
,
"请重新获取验证码!"
,
StatusCode
.
ERROR
);
return
new
Result
(
false
,
"请重新获取验证码!"
,
StatusCode
.
ERROR
);
}
}
// 判断验证码是否一致
// 判断验证码是否一致
if
(!
codeInRedis
.
equals
(
paramMap
.
get
(
"validateCode"
)
))
{
if
(!
codeInRedis
.
equals
(
validateCode
))
{
return
new
Result
(
false
,
"验证码不正确!"
,
StatusCode
.
ERROR
);
return
new
Result
(
false
,
"验证码不正确!"
,
StatusCode
.
ERROR
);
}
}
// 删除redis的验证码
// 删除redis的验证码
...
@@ -109,13 +112,13 @@ public class LoginController {
...
@@ -109,13 +112,13 @@ public class LoginController {
@ApiOperation
(
value
=
"手机号码校验接口"
,
notes
=
"手机号码是否已注册"
)
@ApiOperation
(
value
=
"手机号码校验接口"
,
notes
=
"手机号码是否已注册"
)
public
Result
phoneCheck
(
@RequestParam
(
"telephone"
)
String
telephone
)
{
public
Result
phoneCheck
(
@RequestParam
(
"telephone"
)
String
telephone
)
{
if
(
telephone
==
null
)
{
if
(
telephone
==
null
)
{
return
new
Result
(
false
,
"请重新输入手机号!"
);
return
new
Result
(
false
,
"请重新输入手机号!"
,
StatusCode
.
ERROR
);
}
}
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
telephone
);
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
telephone
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
!=
null
)
{
return
new
Result
(
false
,
"手机号码已注册!"
);
return
new
Result
(
false
,
"手机号码已注册!"
,
StatusCode
.
ERROR
);
}
}
return
new
Result
(
true
,
"手机号码未注册!"
);
return
new
Result
(
true
,
"手机号码未注册!"
,
StatusCode
.
OK
);
}
}
...
@@ -136,7 +139,7 @@ public class LoginController {
...
@@ -136,7 +139,7 @@ public class LoginController {
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
telephone
);
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
telephone
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerPhone
().
equals
(
telephone
))
{
if
(
mallCustomer
.
getCustomerPhone
().
equals
(
telephone
))
{
return
new
Result
(
false
,
"手机号相同"
);
return
new
Result
(
false
,
"手机号相同"
,
StatusCode
.
ERROR
);
}
}
}
}
}
}
...
@@ -144,9 +147,9 @@ public class LoginController {
...
@@ -144,9 +147,9 @@ public class LoginController {
CustomerDto
mallCustomer
=
mallCustomerService
.
selectByAccount
(
username
,
request
);
CustomerDto
mallCustomer
=
mallCustomerService
.
selectByAccount
(
username
,
request
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerAccount
().
equals
(
username
))
{
if
(
mallCustomer
.
getCustomerAccount
().
equals
(
username
))
{
return
new
Result
(
false
,
"用户名相同!"
);
return
new
Result
(
false
,
"用户名相同!"
,
StatusCode
.
ERROR
);
}
}
}
}
return
new
Result
(
true
,
"用户名不同!"
);
return
new
Result
(
true
,
"用户名不同!"
,
StatusCode
.
OK
);
}
}
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/MallCustomerController.java
View file @
48d7fc7f
...
@@ -9,6 +9,7 @@ import com.jz.common.constant.ResultCode;
...
@@ -9,6 +9,7 @@ import com.jz.common.constant.ResultCode;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest
;
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
;
...
@@ -34,7 +35,7 @@ import java.util.Map;
...
@@ -34,7 +35,7 @@ import java.util.Map;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/mallCustomer"
)
@RequestMapping
(
"/mallCustomer"
)
@Api
(
tags
=
"商城用户
api
"
)
@Api
(
tags
=
"商城用户
--controller
"
)
public
class
MallCustomerController
extends
BaseController
{
public
class
MallCustomerController
extends
BaseController
{
/**
/**
* 服务对象
* 服务对象
...
@@ -47,32 +48,31 @@ public class MallCustomerController extends BaseController {
...
@@ -47,32 +48,31 @@ public class MallCustomerController extends BaseController {
/**
/**
* 添加用户
* 添加用户
* @param
paramMap
* @param
customer
* @return
* @return
*/
*/
@PostMapping
(
"/saveCustomer"
)
@PostMapping
(
"/saveCustomer"
)
@ApiOperation
(
value
=
"注册用户"
,
notes
=
"添加用户"
)
@ApiOperation
(
value
=
"注册用户"
,
notes
=
"添加用户"
)
public
Result
saveCustomer
(
@RequestParam
(
required
=
true
)
Map
<
String
,
String
>
paramMap
,
HttpServletRequest
request
)
{
public
Result
saveCustomer
(
@RequestBody
CustomerRequest
customer
,
HttpServletRequest
request
)
{
if
(
paramMap
!=
null
)
{
if
(!
StringUtils
.
isEmpty
(
customer
))
{
String
username
=
paramMap
.
get
(
"username"
);
String
telephone
=
paramMap
.
get
(
"telephone"
);
String
ph
=
"^[1][34578]\\d{9}$"
;
String
ph
=
"^[1][34578]\\d{9}$"
;
String
telephone
=
customer
.
getTelephone
();
if
(
telephone
.
matches
(
ph
))
{
if
(
telephone
.
matches
(
ph
))
{
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
telephone
);
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
customer
.
getTelephone
()
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerPhone
().
equals
(
telephone
))
{
if
(
mallCustomer
.
getCustomerPhone
().
equals
(
customer
.
getTelephone
()
))
{
return
new
Result
(
false
,
"手机号相同"
);
return
new
Result
(
false
,
"手机号相同"
,
StatusCode
.
ERROR
);
}
}
}
}
}
}
// 根据手机号查询用户信息
// 根据手机号查询用户信息
CustomerDto
mallCustomer
=
mallCustomerService
.
selectByAccount
(
username
,
request
);
CustomerDto
mallCustomer
=
mallCustomerService
.
selectByAccount
(
customer
.
getUsername
()
,
request
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerAccount
().
equals
(
username
))
{
if
(
mallCustomer
.
getCustomerAccount
().
equals
(
customer
.
getUsername
()
))
{
return
new
Result
(
false
,
"用户名相同"
);
return
new
Result
(
false
,
"用户名相同"
,
StatusCode
.
ERROR
);
}
}
}
}
mallCustomerService
.
saveCustomer
(
paramMap
);
mallCustomerService
.
saveCustomer
(
customer
);
return
new
Result
(
true
,
"注册成功!"
,
StatusCode
.
OK
);
return
new
Result
(
true
,
"注册成功!"
,
StatusCode
.
OK
);
}
}
return
new
Result
(
false
,
"注册失败!"
,
StatusCode
.
ERROR
);
return
new
Result
(
false
,
"注册失败!"
,
StatusCode
.
ERROR
);
...
@@ -84,7 +84,7 @@ public class MallCustomerController extends BaseController {
...
@@ -84,7 +84,7 @@ public class MallCustomerController extends BaseController {
* @return
* @return
*/
*/
@GetMapping
(
"/getLoginUserName"
)
@GetMapping
(
"/getLoginUserName"
)
@ApiOperation
(
value
=
"获取用户信息"
)
@ApiOperation
(
value
=
"获取
当前登录
用户信息"
)
public
Result
getLoginUserName
(
HttpServletRequest
request
)
{
public
Result
getLoginUserName
(
HttpServletRequest
request
)
{
// 从session中获取id
// 从session中获取id
try
{
try
{
...
@@ -95,14 +95,14 @@ public class MallCustomerController extends BaseController {
...
@@ -95,14 +95,14 @@ public class MallCustomerController extends BaseController {
return
new
Result
(
true
,
"获取用户信息成功!"
,
StatusCode
.
OK
,
user
);
return
new
Result
(
true
,
"获取用户信息成功!"
,
StatusCode
.
OK
,
user
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
new
Result
(
false
,
"获取用户信息失败"
);
return
new
Result
(
false
,
"获取用户信息失败"
,
StatusCode
.
ERROR
);
}
}
}
}
@PostMapping
(
value
=
"/updatePassword"
)
@PostMapping
(
value
=
"/updatePassword"
)
@Api
ModelProperty
(
value
=
"密码修改"
)
@Api
Operation
(
value
=
"密码修改"
)
public
Result
updatePassword
(
@RequestParam
(
value
=
"oldPassWard"
)
String
oldPassword
,
public
Result
updatePassword
(
@RequestParam
(
value
=
"oldPassWard"
)
String
oldPassword
,
@RequestParam
(
value
=
"newPassword"
)
String
newPassword
,
HttpServletRequest
request
)
throws
Exception
{
@RequestParam
(
value
=
"newPassword"
)
String
newPassword
,
HttpServletRequest
request
)
throws
Exception
{
// 获取用户信息
// 获取用户信息
MallCustomer
mallCustomer
=
(
MallCustomer
)
getLoginUserName
(
request
).
getData
();
MallCustomer
mallCustomer
=
(
MallCustomer
)
getLoginUserName
(
request
).
getData
();
// 如果密码一致
// 如果密码一致
...
@@ -110,8 +110,8 @@ public class MallCustomerController extends BaseController {
...
@@ -110,8 +110,8 @@ public class MallCustomerController extends BaseController {
// 修改密码
// 修改密码
Long
customerId
=
mallCustomer
.
getCustomerId
();
Long
customerId
=
mallCustomer
.
getCustomerId
();
mallCustomerService
.
updatePassword
(
customerId
,
newPassword
);
mallCustomerService
.
updatePassword
(
customerId
,
newPassword
);
return
new
Result
(
true
,
"密码修改成功"
);
return
new
Result
(
true
,
"密码修改成功"
,
StatusCode
.
OK
);
}
}
return
new
Result
(
false
,
"密码修改失败"
);
return
new
Result
(
false
,
"密码修改失败"
,
StatusCode
.
ERROR
);
}
}
}
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/PersonalUserController.java
View file @
48d7fc7f
...
@@ -22,7 +22,7 @@ import reactor.core.publisher.Mono;
...
@@ -22,7 +22,7 @@ import reactor.core.publisher.Mono;
**/
**/
@RestController
@RestController
@RequestMapping
(
"/personalUser"
)
@RequestMapping
(
"/personalUser"
)
@Api
(
tags
=
"用户信息controller"
)
@Api
(
tags
=
"用户信息
--
controller"
)
public
class
PersonalUserController
{
public
class
PersonalUserController
{
@Autowired
@Autowired
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/ValidateCodeController.java
View file @
48d7fc7f
...
@@ -4,13 +4,17 @@ import com.aliyuncs.exceptions.ClientException;
...
@@ -4,13 +4,17 @@ 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.StatusCode
;
import
com.jz.common.utils.ValidateCodeUtils
;
import
com.jz.common.utils.ValidateCodeUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
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.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -24,7 +28,7 @@ import java.util.concurrent.TimeUnit;
...
@@ -24,7 +28,7 @@ import java.util.concurrent.TimeUnit;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/validateCode"
)
@RequestMapping
(
"/validateCode"
)
@Api
(
tags
=
"短信发送
api
"
)
@Api
(
tags
=
"短信发送
--controller
"
)
public
class
ValidateCodeController
{
public
class
ValidateCodeController
{
@Autowired
@Autowired
...
@@ -36,13 +40,14 @@ public class ValidateCodeController {
...
@@ -36,13 +40,14 @@ public class ValidateCodeController {
* @return
* @return
*/
*/
@PostMapping
(
value
=
"/sendForLogin"
)
@PostMapping
(
value
=
"/sendForLogin"
)
public
Result
sendForLogin
(
String
telephone
)
{
@ApiOperation
(
value
=
"注册时发送的验证码"
)
public
Result
sendForLogin
(
@RequestParam
(
value
=
"telephone"
)
String
telephone
)
{
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
// 通过手机号从redis获取验证码
// 通过手机号从redis获取验证码
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
if
(!
StringUtils
.
isEmpty
(
codeInRedis
))
{
if
(!
StringUtils
.
isEmpty
(
codeInRedis
))
{
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
);
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
,
StatusCode
.
ERROR
);
}
else
{
}
else
{
// 生成验证码
// 生成验证码
String
code
=
ValidateCodeUtils
.
generateValidateCode
(
6
)
+
""
;
String
code
=
ValidateCodeUtils
.
generateValidateCode
(
6
)
+
""
;
...
@@ -51,11 +56,11 @@ public class ValidateCodeController {
...
@@ -51,11 +56,11 @@ public class ValidateCodeController {
SMSUtils
.
sendShortMessage
(
SMSUtils
.
VALIDATE_CODE
,
telephone
,
code
);
SMSUtils
.
sendShortMessage
(
SMSUtils
.
VALIDATE_CODE
,
telephone
,
code
);
}
catch
(
ClientException
e
)
{
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
new
Result
(
false
,
"验证码发送失败!"
);
return
new
Result
(
false
,
"验证码发送失败!"
,
StatusCode
.
ERROR
);
}
}
// 存入redis, 有效期为5分钟
// 存入redis, 有效期为5分钟
redisTemplate
.
opsForValue
().
set
(
key
,
code
,
5
,
TimeUnit
.
MINUTES
);
redisTemplate
.
opsForValue
().
set
(
key
,
code
,
5
,
TimeUnit
.
MINUTES
);
return
new
Result
(
true
,
"验证码发送成功!"
);
return
new
Result
(
true
,
"验证码发送成功!"
,
StatusCode
.
OK
);
}
}
}
}
...
@@ -66,13 +71,14 @@ public class ValidateCodeController {
...
@@ -66,13 +71,14 @@ public class ValidateCodeController {
* @return
* @return
*/
*/
@PostMapping
(
"/send4Code"
)
@PostMapping
(
"/send4Code"
)
public
Result
send4Code
(
String
telephone
)
{
@ApiOperation
(
value
=
"修改密码发送验证码"
)
public
Result
send4Code
(
@RequestParam
(
value
=
"telephone"
)
String
telephone
)
{
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
// 通过手机号从redis获取验证码
// 通过手机号从redis获取验证码
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
if
(!
StringUtils
.
isEmpty
(
codeInRedis
))
{
if
(!
StringUtils
.
isEmpty
(
codeInRedis
))
{
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
);
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
,
StatusCode
.
ERROR
);
}
else
{
}
else
{
// 生成验证码
// 生成验证码
String
code
=
ValidateCodeUtils
.
generateValidateCode
(
6
)
+
""
;
String
code
=
ValidateCodeUtils
.
generateValidateCode
(
6
)
+
""
;
...
@@ -81,11 +87,11 @@ public class ValidateCodeController {
...
@@ -81,11 +87,11 @@ public class ValidateCodeController {
SMSUtils
.
sendShortMessage
(
SMSUtils
.
VALIDATE_CODE
,
telephone
,
code
);
SMSUtils
.
sendShortMessage
(
SMSUtils
.
VALIDATE_CODE
,
telephone
,
code
);
}
catch
(
ClientException
e
)
{
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
new
Result
(
false
,
"验证码发送失败!"
);
return
new
Result
(
false
,
"验证码发送失败!"
,
StatusCode
.
ERROR
);
}
}
// 存入redis, 有效期为5分钟
// 存入redis, 有效期为5分钟
redisTemplate
.
opsForValue
().
set
(
key
,
code
,
5
,
TimeUnit
.
MINUTES
);
redisTemplate
.
opsForValue
().
set
(
key
,
code
,
5
,
TimeUnit
.
MINUTES
);
return
new
Result
(
true
,
"验证码发送成功!"
);
return
new
Result
(
true
,
"验证码发送成功!"
,
StatusCode
.
OK
);
}
}
}
}
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/bean/CustomerDto.java
View file @
48d7fc7f
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
.
bean
;
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
/**
/**
* @ClassName: CustomerDto
* @ClassName: CustomerDto
...
@@ -15,33 +16,51 @@ public class CustomerDto {
...
@@ -15,33 +16,51 @@ public class CustomerDto {
/**
/**
* 用户id
* 用户id
*/
*/
@ApiModelProperty
(
value
=
"账户id"
)
private
Long
customerId
;
private
Long
customerId
;
/**
/**
* 企业id
* 企业id
*/
*/
@ApiModelProperty
(
value
=
"企业id"
)
private
Long
departmentId
;
private
Long
departmentId
;
/**
/**
* 密码
* 密码
*/
*/
@ApiModelProperty
(
value
=
"密码"
)
private
String
password
;
private
String
password
;
/**
/**
* 账户
* 账户
*/
*/
@ApiModelProperty
(
value
=
"账户"
)
private
String
customerAccount
;
private
String
customerAccount
;
/**
/**
* 用户真实姓名
* 用户真实姓名
*/
*/
@ApiModelProperty
(
value
=
"真实姓名"
)
private
String
customerName
;
private
String
customerName
;
/**
/**
* 联系电话
* 联系电话
*/
*/
@ApiModelProperty
(
value
=
"电话"
)
private
String
customerPhone
;
private
String
customerPhone
;
/**
/**
* 资产账户id
* 资产账户id
*/
*/
@ApiModelProperty
(
value
=
"资产账户id"
)
private
String
assetsId
;
private
String
assetsId
;
@ApiModelProperty
(
value
=
"头像"
)
private
String
headPortraitUrl
;
public
String
getHeadPortraitUrl
()
{
return
headPortraitUrl
;
}
public
void
setHeadPortraitUrl
(
String
headPortraitUrl
)
{
this
.
headPortraitUrl
=
headPortraitUrl
;
}
public
Long
getCustomerId
()
{
public
Long
getCustomerId
()
{
return
customerId
;
return
customerId
;
}
}
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/bean/req/CustomerRequest.java
0 → 100644
View file @
48d7fc7f
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
.
bean
.
req
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/17
* @Version:
*/
@ApiModel
(
value
=
"注册用户接受的参数"
)
public
class
CustomerRequest
{
@ApiModelProperty
(
value
=
"用户名"
)
private
String
username
;
@ApiModelProperty
(
value
=
"手机号"
)
private
String
telephone
;
@ApiModelProperty
(
value
=
"验证码"
)
private
String
vailCode
;
@ApiModelProperty
(
value
=
"密码"
)
private
String
password
;
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getTelephone
()
{
return
telephone
;
}
public
void
setTelephone
(
String
telephone
)
{
this
.
telephone
=
telephone
;
}
public
String
getVailCode
()
{
return
vailCode
;
}
public
void
setVailCode
(
String
vailCode
)
{
this
.
vailCode
=
vailCode
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/bean/req/LoginRequest.java
0 → 100644
View file @
48d7fc7f
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
.
bean
.
req
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/17
* @Version:
*/
@ApiModel
(
value
=
"用户登录接受的参数"
)
public
class
LoginRequest
{
@ApiModelProperty
(
value
=
"验证码"
)
private
String
vailCode
;
@ApiModelProperty
(
value
=
"密码"
)
private
String
password
;
@ApiModelProperty
(
value
=
"用户名"
)
private
String
username
;
public
String
getVailCode
()
{
return
vailCode
;
}
public
void
setVailCode
(
String
vailCode
)
{
this
.
vailCode
=
vailCode
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/goods/DataGoodsApiController.java
View file @
48d7fc7f
...
@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
*/
@RestController
@RestController
@RequestMapping
(
"dataGoodsApi"
)
@RequestMapping
(
"dataGoodsApi"
)
@Api
(
"api商品详情
"
)
@Api
(
tags
=
"商品详情--controller
"
)
public
class
DataGoodsApiController
extends
BaseController
{
public
class
DataGoodsApiController
extends
BaseController
{
/**
/**
* 服务对象
* 服务对象
...
@@ -44,6 +44,6 @@ public class DataGoodsApiController extends BaseController {
...
@@ -44,6 +44,6 @@ public class DataGoodsApiController extends BaseController {
DataGoodsApiDto
dataGoodsApi
=
tDataGoodsApiService
.
selectById
(
id
);
DataGoodsApiDto
dataGoodsApi
=
tDataGoodsApiService
.
selectById
(
id
);
return
new
Result
<
DataGoodsApiDto
>(
true
,
"查询商品详情成功!"
,
StatusCode
.
OK
,
dataGoodsApi
);
return
new
Result
<
DataGoodsApiDto
>(
true
,
"查询商品详情成功!"
,
StatusCode
.
OK
,
dataGoodsApi
);
}
}
return
new
Result
<>(
false
,
"查询商品详情失败!"
);
return
new
Result
<>(
false
,
"查询商品详情失败!"
,
StatusCode
.
ERROR
);
}
}
}
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/goods/DataGoodsController.java
View file @
48d7fc7f
...
@@ -11,6 +11,7 @@ import com.jz.dm.mall.moduls.controller.goods.bean.request.DataGoodsListRequest;
...
@@ -11,6 +11,7 @@ import com.jz.dm.mall.moduls.controller.goods.bean.request.DataGoodsListRequest;
import
com.jz.dm.mall.moduls.controller.goods.bean.request.DataGoodsRequest
;
import
com.jz.dm.mall.moduls.controller.goods.bean.request.DataGoodsRequest
;
import
com.jz.dm.mall.moduls.entity.DataGoods
;
import
com.jz.dm.mall.moduls.entity.DataGoods
;
import
com.jz.dm.mall.moduls.service.DataGoodsService
;
import
com.jz.dm.mall.moduls.service.DataGoodsService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -26,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -26,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
*/
*/
@RestController
@RestController
@RequestMapping
(
"dataGoods"
)
@RequestMapping
(
"dataGoods"
)
@Api
(
tags
=
"数据商品--controller"
)
public
class
DataGoodsController
extends
BaseController
{
public
class
DataGoodsController
extends
BaseController
{
/**
/**
* 服务对象
* 服务对象
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/goods/MallHotRecommendGoodsController.java
View file @
48d7fc7f
...
@@ -22,7 +22,7 @@ import java.util.List;
...
@@ -22,7 +22,7 @@ import java.util.List;
*/
*/
@RestController
@RestController
@RequestMapping
(
"mallHotRecommendGoods"
)
@RequestMapping
(
"mallHotRecommendGoods"
)
@Api
(
tags
=
"热门商品
api
"
)
@Api
(
tags
=
"热门商品
--controller
"
)
public
class
MallHotRecommendGoodsController
extends
BaseController
{
public
class
MallHotRecommendGoodsController
extends
BaseController
{
/**
/**
* 服务对象
* 服务对象
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/order/OrderController.java
View file @
48d7fc7f
...
@@ -25,7 +25,7 @@ import java.util.Map;
...
@@ -25,7 +25,7 @@ import java.util.Map;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/order"
)
@RequestMapping
(
"/order"
)
@Api
(
tags
=
"订单管理"
)
@Api
(
tags
=
"订单管理
--controller
"
)
public
class
OrderController
{
public
class
OrderController
{
/**
/**
* 服务对象
* 服务对象
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/MallCustomerService.java
View file @
48d7fc7f
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
;
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -30,9 +31,9 @@ public interface MallCustomerService {
...
@@ -30,9 +31,9 @@ public interface MallCustomerService {
/**
/**
* 注册账号
* 注册账号
* @param
paramMap
* @param
customerRequest
*/
*/
void
saveCustomer
(
Map
<
String
,
String
>
paramMap
);
void
saveCustomer
(
CustomerRequest
customerRequest
);
/**
/**
* 通过手机号查询是否已注册
* 通过手机号查询是否已注册
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
View file @
48d7fc7f
...
@@ -7,6 +7,7 @@ import com.jz.common.enums.UserTypeEnum;
...
@@ -7,6 +7,7 @@ import com.jz.common.enums.UserTypeEnum;
import
com.jz.common.utils.DateUtils
;
import
com.jz.common.utils.DateUtils
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest
;
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
;
...
@@ -91,15 +92,15 @@ public class MallCustomerServiceImpl implements MallCustomerService {
...
@@ -91,15 +92,15 @@ public class MallCustomerServiceImpl implements MallCustomerService {
/**
/**
* 注册账号
* 注册账号
*
*
* @param
paramMap
* @param
*/
*/
@Override
@Override
public
void
saveCustomer
(
Map
<
String
,
String
>
paramMap
)
{
public
void
saveCustomer
(
CustomerRequest
customerRequest
)
{
MallCustomer
mallCustomer
=
new
MallCustomer
();
MallCustomer
mallCustomer
=
new
MallCustomer
();
// 获取验证码
// 获取验证码
String
vailCode
=
paramMap
.
get
(
"vailCode"
);
String
vailCode
=
customerRequest
.
getVailCode
(
);
String
username
=
paramMap
.
get
(
"username"
);
String
username
=
customerRequest
.
getUsername
(
);
String
telephone
=
paramMap
.
get
(
"telephone"
);
String
telephone
=
customerRequest
.
getTelephone
(
);
// 从redis获取验证码
// 从redis获取验证码
// String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
...
@@ -108,7 +109,7 @@ public class MallCustomerServiceImpl implements MallCustomerService {
...
@@ -108,7 +109,7 @@ public class MallCustomerServiceImpl implements MallCustomerService {
String
codeInRedis
=
"147826"
;
String
codeInRedis
=
"147826"
;
if
(
codeInRedis
.
equals
(
vailCode
))
{
if
(
codeInRedis
.
equals
(
vailCode
))
{
mallCustomer
.
setCustomerAccount
(
username
);
mallCustomer
.
setCustomerAccount
(
username
);
mallCustomer
.
setPassword
(
paramMap
.
get
(
"password"
));
mallCustomer
.
setPassword
(
customerRequest
.
getPassword
(
));
mallCustomer
.
setCustomerPhone
(
telephone
);
mallCustomer
.
setCustomerPhone
(
telephone
);
mallCustomer
.
setCreTime
(
DateUtils
.
getToday
());
mallCustomer
.
setCreTime
(
DateUtils
.
getToday
());
mallCustomer
.
setRegisterTime
(
DateUtils
.
getToday
());
mallCustomer
.
setRegisterTime
(
DateUtils
.
getToday
());
...
...
jz-dm-mall/src/main/resources/mapperconf/MallCustomerDao.xml
View file @
48d7fc7f
...
@@ -173,6 +173,7 @@
...
@@ -173,6 +173,7 @@
t1.customer_account as customerAccount,
t1.customer_account as customerAccount,
t1.customer_name as customerName,
t1.customer_name as customerName,
t1.customer_phone as customerPhone,
t1.customer_phone as customerPhone,
t1.head_portrait_url as headPortraitUrl,
t3.assets_id as assetsId
t3.assets_id as assetsId
from t_mall_customer t1
from t_mall_customer t1
left join t_department t2 on t1.department_id=t2.department_id
left join t_department t2 on t1.department_id=t2.department_id
...
@@ -188,6 +189,7 @@
...
@@ -188,6 +189,7 @@
t1.customer_account as customerAccount,
t1.customer_account as customerAccount,
t1.customer_name as customerName,
t1.customer_name as customerName,
t1.customer_phone as customerPhone,
t1.customer_phone as customerPhone,
t1.head_portrait_url as headPortraitUrl,
t3.assets_id as assetsId
t3.assets_id as assetsId
from t_mall_customer t1
from t_mall_customer t1
left join t_department t2 on t1.department_id=t2.department_id
left join t_department t2 on t1.department_id=t2.department_id
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/customer/DepartmentController.java
View file @
48d7fc7f
...
@@ -63,7 +63,7 @@ public class DepartmentController extends BaseController {
...
@@ -63,7 +63,7 @@ public class DepartmentController extends BaseController {
* @param req
* @param req
* @return
* @return
*/
*/
@GetMapping
(
value
=
"/{id}"
)
@GetMapping
(
value
=
"/
getDepartment/
{id}"
)
@ApiOperation
(
value
=
"主键查询用户企业详情信息"
)
@ApiOperation
(
value
=
"主键查询用户企业详情信息"
)
public
Result
<
CompanyDetailsDto
>
selectById
(
@PathVariable
(
value
=
"id"
)
Long
id
,
HttpServletRequest
req
)
{
public
Result
<
CompanyDetailsDto
>
selectById
(
@PathVariable
(
value
=
"id"
)
Long
id
,
HttpServletRequest
req
)
{
if
(
id
!=
null
)
{
if
(
id
!=
null
)
{
...
@@ -80,19 +80,26 @@ public class DepartmentController extends BaseController {
...
@@ -80,19 +80,26 @@ public class DepartmentController extends BaseController {
*/
*/
@PostMapping
(
value
=
"/audit/{id}"
)
@PostMapping
(
value
=
"/audit/{id}"
)
@ApiModelProperty
(
value
=
"企业审核"
)
@ApiModelProperty
(
value
=
"企业审核"
)
public
Result
audit
(
@PathVariable
(
value
=
"id"
)
Long
id
)
{
public
Result
audit
(
@PathVariable
(
value
=
"id"
)
Long
id
,
HttpServletRequest
req
)
{
if
(
id
!=
null
)
{
if
(
id
!=
null
)
{
departmentService
.
audit
(
id
);
departmentService
.
audit
(
id
,
req
);
return
new
Result
<
CompanyDetailsDto
>(
true
,
"企业审核成功!"
,
StatusCode
.
OK
);
return
new
Result
<
CompanyDetailsDto
>(
true
,
"企业审核成功!"
,
StatusCode
.
OK
);
}
}
return
new
Result
<
CompanyDetailsDto
>(
false
,
"企业审核失败!"
,
StatusCode
.
ERROR
);
return
new
Result
<
CompanyDetailsDto
>(
false
,
"企业审核失败!"
,
StatusCode
.
ERROR
);
}
}
/**
* 添加用户
* @param saveCustomerRequest
* @param req
* @return
* @throws Exception
*/
@PostMapping
(
value
=
"/add"
)
@PostMapping
(
value
=
"/add"
)
@ApiModelProperty
(
value
=
"添加用户"
)
@ApiModelProperty
(
value
=
"添加用户"
)
public
Result
add
(
@RequestBody
SaveCustomerRequest
saveCustomerRequest
,
HttpServletRequest
req
)
throws
Exception
{
public
Result
add
(
@RequestBody
SaveCustomerRequest
saveCustomerRequest
,
HttpServletRequest
req
)
throws
Exception
{
if
(
saveCustomerRequest
!=
null
)
{
if
(
saveCustomerRequest
!=
null
)
{
Result
result
=
departmentService
.
add
(
saveCustomerRequest
);
Result
result
=
departmentService
.
add
(
saveCustomerRequest
,
req
);
result
.
getMessage
();
result
.
getMessage
();
result
.
getCode
();
result
.
getCode
();
return
result
;
return
result
;
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/goods/DataGoodsApiController.java
View file @
48d7fc7f
...
@@ -41,6 +41,6 @@ public class DataGoodsApiController extends BaseController {
...
@@ -41,6 +41,6 @@ public class DataGoodsApiController extends BaseController {
DataGoodsApiDto
dataGoodsApi
=
tDataGoodsApiService
.
selectById
(
id
);
DataGoodsApiDto
dataGoodsApi
=
tDataGoodsApiService
.
selectById
(
id
);
return
new
Result
<
DataGoodsApiDto
>(
true
,
"查询商品详情成功!"
,
StatusCode
.
OK
,
dataGoodsApi
);
return
new
Result
<
DataGoodsApiDto
>(
true
,
"查询商品详情成功!"
,
StatusCode
.
OK
,
dataGoodsApi
);
}
}
return
new
Result
<>(
false
,
"查询商品详情失败!"
);
return
new
Result
<>(
false
,
"查询商品详情失败!"
,
StatusCode
.
ERROR
);
}
}
}
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/DepartmentService.java
View file @
48d7fc7f
...
@@ -37,11 +37,11 @@ public interface DepartmentService {
...
@@ -37,11 +37,11 @@ public interface DepartmentService {
* 企业审核信息
* 企业审核信息
* @param id
* @param id
*/
*/
void
audit
(
Long
id
);
void
audit
(
Long
id
,
HttpServletRequest
req
);
/**
/**
* 添加用户
* 添加用户
* @param saveCustomerRequest
* @param saveCustomerRequest
*/
*/
Result
add
(
SaveCustomerRequest
saveCustomerRequest
);
Result
add
(
SaveCustomerRequest
saveCustomerRequest
,
HttpServletRequest
req
);
}
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/impl/DepartmentServiceImpl.java
View file @
48d7fc7f
...
@@ -3,6 +3,7 @@ package com.jz.manage.moduls.service.impl;
...
@@ -3,6 +3,7 @@ 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.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.common.bean.MallCustomerApiDto
;
import
com.jz.common.bean.PageInfoResponse
;
import
com.jz.common.bean.PageInfoResponse
;
import
com.jz.common.constant.Constants
;
import
com.jz.common.constant.Constants
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultCode
;
...
@@ -10,11 +11,13 @@ import com.jz.common.exception.ResponseException;
...
@@ -10,11 +11,13 @@ import com.jz.common.exception.ResponseException;
import
com.jz.common.utils.DateUtils
;
import
com.jz.common.utils.DateUtils
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.manage.moduls.controller.customer.bean.dto.CompanyDetailsDto
;
import
com.jz.manage.moduls.controller.customer.bean.dto.CompanyDetailsDto
;
import
com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto
;
import
com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto
;
import
com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest
;
import
com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest
;
import
com.jz.manage.moduls.controller.customer.bean.request.SaveCustomerRequest
;
import
com.jz.manage.moduls.controller.customer.bean.request.SaveCustomerRequest
;
import
com.jz.manage.moduls.controller.sys.bean.SysUserDto
;
import
com.jz.manage.moduls.entity.Department
;
import
com.jz.manage.moduls.entity.Department
;
import
com.jz.manage.moduls.entity.FinanceCustomerAssets
;
import
com.jz.manage.moduls.entity.FinanceCustomerAssets
;
import
com.jz.manage.moduls.entity.FinanceCustomerBalance
;
import
com.jz.manage.moduls.entity.FinanceCustomerBalance
;
...
@@ -113,7 +116,7 @@ public class DepartmentServiceImpl implements DepartmentService {
...
@@ -113,7 +116,7 @@ public class DepartmentServiceImpl implements DepartmentService {
*/
*/
@Override
@Override
@Transactional
@Transactional
public
void
audit
(
Long
id
)
{
public
void
audit
(
Long
id
,
HttpServletRequest
req
)
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"department_id"
,
id
);
queryWrapper
.
eq
(
"department_id"
,
id
);
// 获取企业详细信息
// 获取企业详细信息
...
@@ -121,21 +124,21 @@ public class DepartmentServiceImpl implements DepartmentService {
...
@@ -121,21 +124,21 @@ public class DepartmentServiceImpl implements DepartmentService {
// if (department.getAuditStatus().equals("02") ) {
// if (department.getAuditStatus().equals("02") ) {
// throw ResponseException.of(ResultCode.FAILURE, "已审核!不用在审核!");
// throw ResponseException.of(ResultCode.FAILURE, "已审核!不用在审核!");
// }
// }
// 从session获取
商城
用户id
// 从session获取
平台
用户id
SysUserDto
sysUser
=
(
SysUserDto
)
SessionUtils
.
getUserCurrent
(
req
,
"sysUser"
);
// 更新信息: 将企业审核状态改为已审核,企业信息更新
// 更新信息: 将企业审核状态改为已审核,企业信息更新
department
.
setAuditStatus
(
"02"
);
department
.
setAuditStatus
(
"02"
);
department
.
setAuditPerson
(
"1
"
);
department
.
setAuditPerson
(
sysUser
.
getUserId
()
+
"
"
);
department
.
setAuditTime
(
DateUtils
.
getToday
());
department
.
setAuditTime
(
DateUtils
.
getToday
());
department
.
setUptTime
(
DateUtils
.
getToday
());
department
.
setUptTime
(
DateUtils
.
getToday
());
department
.
setUptPerson
(
department
.
getUptPerson
()
);
department
.
setUptPerson
(
sysUser
.
getUserId
()+
""
);
tDepartmentDao
.
updateById
(
department
);
tDepartmentDao
.
updateById
(
department
);
// 新增企业客户资产
// 新增企业客户资产
FinanceCustomerAssets
financeCustomerAssets
=
new
FinanceCustomerAssets
();
FinanceCustomerAssets
financeCustomerAssets
=
new
FinanceCustomerAssets
();
financeCustomerAssets
.
setDepartmentId
(
department
.
getDepartmentId
());
financeCustomerAssets
.
setDepartmentId
(
department
.
getDepartmentId
());
financeCustomerAssets
.
setCreTime
(
DateUtils
.
getToday
());
financeCustomerAssets
.
setCreTime
(
DateUtils
.
getToday
());
financeCustomerAssets
.
setCrePerson
(
"1
"
);
financeCustomerAssets
.
setCrePerson
(
sysUser
.
getUserId
()
+
"
"
);
financeCustomerAssetsDao
.
insert
(
financeCustomerAssets
);
financeCustomerAssetsDao
.
insert
(
financeCustomerAssets
);
}
}
...
@@ -147,15 +150,16 @@ public class DepartmentServiceImpl implements DepartmentService {
...
@@ -147,15 +150,16 @@ public class DepartmentServiceImpl implements DepartmentService {
*/
*/
@Override
@Override
@Transactional
()
@Transactional
()
public
Result
add
(
SaveCustomerRequest
saveCustomerReq
)
{
public
Result
add
(
SaveCustomerRequest
saveCustomerReq
,
HttpServletRequest
req
)
{
// 校验信息
// 校验信息
Result
s
=
userCheck
(
saveCustomerReq
);
Result
s
=
userCheck
(
saveCustomerReq
);
boolean
success
=
s
.
isSuccess
();
boolean
success
=
s
.
isSuccess
();
if
(!
success
)
{
if
(!
success
)
{
return
Result
.
error
(
"添加用户失败!"
);
return
Result
.
error
(
"添加用户失败!"
);
}
}
SysUserDto
sysUser
=
(
SysUserDto
)
SessionUtils
.
getUserCurrent
(
req
,
"sysUser"
);
// 保存企业信息
// 保存企业信息
Long
departmentId
=
saveCompany
(
saveCustomerReq
);
Long
departmentId
=
saveCompany
(
saveCustomerReq
,
req
);
if
(
departmentId
!=
null
)
{
if
(
departmentId
!=
null
)
{
// 保存账号信息
// 保存账号信息
MallCustomer
mallCustomer
=
new
MallCustomer
();
MallCustomer
mallCustomer
=
new
MallCustomer
();
...
@@ -165,10 +169,9 @@ public class DepartmentServiceImpl implements DepartmentService {
...
@@ -165,10 +169,9 @@ public class DepartmentServiceImpl implements DepartmentService {
mallCustomer
.
setPassword
(
saveCustomerReq
.
getPassword
());
mallCustomer
.
setPassword
(
saveCustomerReq
.
getPassword
());
mallCustomer
.
setCreTime
(
DateUtils
.
getToday
());
mallCustomer
.
setCreTime
(
DateUtils
.
getToday
());
mallCustomer
.
setCustomerPoint
(
0L
);
mallCustomer
.
setCustomerPoint
(
0L
);
mallCustomer
.
setCrePerson
(
"1
"
);
mallCustomer
.
setCrePerson
(
sysUser
.
getUserId
()+
"
"
);
mallCustomer
.
setDelFlag
(
"N"
);
mallCustomer
.
setDelFlag
(
"N"
);
mallCustomerDao
.
insert
(
mallCustomer
);
mallCustomerDao
.
insert
(
mallCustomer
);
System
.
out
.
println
(
mallCustomer
.
getCustomerId
());
// 如果充值金额不为空
// 如果充值金额不为空
if
(
saveCustomerReq
.
getBalanceMoney
()
!=
null
)
{
if
(
saveCustomerReq
.
getBalanceMoney
()
!=
null
)
{
...
@@ -214,10 +217,11 @@ public class DepartmentServiceImpl implements DepartmentService {
...
@@ -214,10 +217,11 @@ public class DepartmentServiceImpl implements DepartmentService {
* 保存企业信息
* 保存企业信息
* @param saveCustomerReq
* @param saveCustomerReq
*/
*/
private
Long
saveCompany
(
SaveCustomerRequest
saveCustomerReq
)
{
private
Long
saveCompany
(
SaveCustomerRequest
saveCustomerReq
,
HttpServletRequest
req
)
{
Department
department
=
new
Department
();
Department
department
=
new
Department
();
SysUserDto
sysUser
=
(
SysUserDto
)
SessionUtils
.
getUserCurrent
(
req
,
"sysUser"
);
// 添加创建人/创建时间
// 添加创建人/创建时间
department
.
setCrePerson
(
"1
"
);
department
.
setCrePerson
(
sysUser
.
getUserId
()
+
"
"
);
department
.
setCreTime
(
DateUtils
.
getToday
());
department
.
setCreTime
(
DateUtils
.
getToday
());
// 基本信息
// 基本信息
department
.
setDepartmentName
(
saveCustomerReq
.
getDepartmentName
());
department
.
setDepartmentName
(
saveCustomerReq
.
getDepartmentName
());
...
...
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