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
00fbc440
Commit
00fbc440
authored
Dec 03, 2020
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复启动异常
parent
8684ae6f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
113 additions
and
143 deletions
+113
-143
UserContextUtil.java
...on/src/main/java/com/jz/common/utils/UserContextUtil.java
+0
-35
CompanyAuthController.java
...mall/moduls/controller/company/CompanyAuthController.java
+2
-2
LoginController.java
...z/dm/mall/moduls/controller/customer/LoginController.java
+0
-1
ValidateCodeController.java
...ll/moduls/controller/customer/ValidateCodeController.java
+81
-81
MallCustomerDao.java
...in/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
+1
-1
CompanyAuthService.java
...ava/com/jz/dm/mall/moduls/service/CompanyAuthService.java
+2
-1
MallCustomerService.java
...va/com/jz/dm/mall/moduls/service/MallCustomerService.java
+1
-1
CompanyAuthServiceImpl.java
...z/dm/mall/moduls/service/impl/CompanyAuthServiceImpl.java
+13
-7
MallCustomerServiceImpl.java
.../dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
+1
-2
pom.xml
pom.xml
+12
-12
No files found.
jz-dm-common/src/main/java/com/jz/common/utils/UserContextUtil.java
deleted
100644 → 0
View file @
8684ae6f
package
com
.
jz
.
common
.
utils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @ClassName: 将数据从session存储/取出
* @Author: Carl
* @Date: 2020/12/2
* @Version:
*/
public
class
UserContextUtil
{
/**
* 从session中获取数据
* @param objName 存储到session中的对象的变量名
*/
public
static
Object
pop
(
String
objName
)
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
return
request
.
getSession
().
getAttribute
(
objName
);
}
/**
* 把数据存储到session中
* @param objName 存储到session中的对象的变量名
* @param o 存储的任意数据
*/
public
static
void
push
(
String
objName
,
Object
o
)
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
request
.
getSession
().
setAttribute
(
objName
,
o
);
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/company/CompanyAuthController.java
View file @
00fbc440
...
...
@@ -52,11 +52,11 @@ public class CompanyAuthController {
*/
@GetMapping
(
"/findCompany"
)
@ApiOperation
(
value
=
"企业认证信息查询"
)
public
Mono
<
Result
>
selectCompany
(
HttpServletRequest
httpRequest
)
{
public
Mono
<
Result
>
selectCompany
(
@RequestParam
(
value
=
"type"
)
String
type
)
{
return
Mono
.
fromSupplier
(()
->{
//TODO 获取当前登录用户
//httpRequest.getSession().getServletContext().getAttribute("customer_id");
return
Result
.
ok
(
companyAuthService
.
selectCompany
());
return
Result
.
ok
(
companyAuthService
.
selectCompany
(
type
));
});
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/LoginController.java
View file @
00fbc440
...
...
@@ -2,7 +2,6 @@ package com.jz.dm.mall.moduls.controller.customer;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.common.utils.UserContextUtil
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
io.swagger.annotations.Api
;
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/ValidateCodeController.java
View file @
00fbc440
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.SMSUtils
;
import
com.jz.common.utils.ValidateCodeUtils
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
redis.clients.jedis.Jedis
;
import
redis.clients.jedis.JedisPool
;
/**
* @ClassName: 短信发送接口
* @Author: Carl
* @Date: 2020/12/2
* @Version:
*/
@RestController
@RequestMapping
(
"/validateCode"
)
@Api
(
tags
=
"短信发送api"
)
public
class
ValidateCodeController
{
@Autowired
private
JedisPool
jedisPool
;
/**
* 注册时发送的验证码
* @param telephone
* @return
*/
@PostMapping
(
"/send4Login"
)
public
Result
send4Login
(
String
telephone
)
{
// 查询redis里是否存在该手机号
Jedis
jedis
=
jedisPool
.
getResource
();
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
String
codeInRedis
=
jedis
.
get
(
key
);
if
(
codeInRedis
!=
null
&&
!
codeInRedis
.
equals
(
""
))
{
// redis中的数据还未过期
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
);
}
else
{
Integer
code
=
ValidateCodeUtils
.
generateValidateCode
(
6
);
try
{
SMSUtils
.
sendShortMessage
(
SMSUtils
.
VALIDATE_CODE
,
telephone
,
code
.
toString
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
jedis
.
setex
(
key
,
5
*
60
,
code
+
""
);
return
new
Result
(
true
,
"验证码发送成功!"
);
}
}
/**
* 修改密码发送验证码
* @param telephone
* @return
*/
@PostMapping
(
"/send4Code"
)
public
Result
send4Code
(
String
telephone
)
{
// 查询redis里是否存在该手机号
Jedis
jedis
=
jedisPool
.
getResource
();
String
key
=
RedisMessageConstant
.
SENDTYPE_GETPWD
+
"_"
+
telephone
;
String
codeInRedis
=
jedis
.
get
(
key
);
if
(
codeInRedis
!=
null
&&
!
codeInRedis
.
equals
(
""
))
{
// redis中的数据还未过期
return
new
Result
(
false
,
"验证码已发送,请注意查收!"
);
}
else
{
Integer
code
=
ValidateCodeUtils
.
generateValidateCode
(
6
);
try
{
SMSUtils
.
sendShortMessage
(
SMSUtils
.
VALIDATE_CODE
,
telephone
,
code
.
toString
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
jedis
.
setex
(
key
,
5
*
60
,
code
+
""
);
return
new
Result
(
true
,
"验证码发送成功!"
);
}
}
}
//
package com.jz.dm.mall.moduls.controller.customer;
//
//
import com.aliyuncs.exceptions.ClientException;
//
import com.jz.common.constant.RedisMessageConstant;
//
import com.jz.common.utils.Result;
//
import com.jz.common.utils.SMSUtils;
//
import com.jz.common.utils.ValidateCodeUtils;
//
import io.swagger.annotations.Api;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.web.bind.annotation.PostMapping;
//
import org.springframework.web.bind.annotation.RequestMapping;
//
import org.springframework.web.bind.annotation.RestController;
//
import redis.clients.jedis.Jedis;
//
import redis.clients.jedis.JedisPool;
//
/
//
**
//
* @ClassName: 短信发送接口
//
* @Author: Carl
//
* @Date: 2020/12/2
//
* @Version:
//
*/
//
@RestController
//
@RequestMapping("/validateCode")
//
@Api(tags = "短信发送api")
//
public class ValidateCodeController {
//
// //
@Autowired
// //
private JedisPool jedisPool;
//
//
/**
//
* 注册时发送的验证码
//
* @param telephone
//
* @return
//
*/
//
@PostMapping("/send4Login")
//
public Result send4Login(String telephone) {
//
// 查询redis里是否存在该手机号
//
Jedis jedis = jedisPool.getResource();
//
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
//
String codeInRedis = jedis.get(key);
//
if (codeInRedis != null && !codeInRedis.equals("")) {
//
// redis中的数据还未过期
//
return new Result(false, "验证码已发送,请注意查收!");
//
}else {
//
Integer code = ValidateCodeUtils.generateValidateCode(6);
//
try {
//
SMSUtils.sendShortMessage(SMSUtils.VALIDATE_CODE, telephone, code.toString());
//
} catch (Exception e) {
//
e.printStackTrace();
//
}
//
jedis.setex(key,5*60,code+"");
//
return new Result(true, "验证码发送成功!");
//
}
//
}
//
//
/**
//
* 修改密码发送验证码
//
* @param telephone
//
* @return
//
*/
//
@PostMapping("/send4Code")
//
public Result send4Code(String telephone) {
//
// 查询redis里是否存在该手机号
//
Jedis jedis = jedisPool.getResource();
//
String key = RedisMessageConstant.SENDTYPE_GETPWD + "_" + telephone;
//
String codeInRedis = jedis.get(key);
//
if (codeInRedis != null && !codeInRedis.equals("")) {
//
// redis中的数据还未过期
//
return new Result(false, "验证码已发送,请注意查收!");
//
}else {
//
Integer code = ValidateCodeUtils.generateValidateCode(6);
//
try {
//
SMSUtils.sendShortMessage(SMSUtils.VALIDATE_CODE, telephone, code.toString());
//
} catch (Exception e) {
//
e.printStackTrace();
//
}
//
jedis.setex(key,5*60,code+"");
//
return new Result(true, "验证码发送成功!");
//
}
//
}
//
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
View file @
00fbc440
package
com
.
jz
.
dm
.
mall
.
moduls
.
mapper
;
import
com.jz.common.base.BaseMapper
;
import
com.jz.
common
.entity.MallCustomer
;
import
com.jz.
dm.mall.moduls
.entity.MallCustomer
;
import
org.apache.ibatis.annotations.ResultType
;
import
org.apache.ibatis.annotations.Select
;
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/CompanyAuthService.java
View file @
00fbc440
...
...
@@ -24,9 +24,10 @@ public interface CompanyAuthService {
/**
* 查询企业认证详情
* @param type
* @return
*/
Result
<
Department
>
selectCompany
();
Result
<
Department
>
selectCompany
(
String
type
);
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/MallCustomerService.java
View file @
00fbc440
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
;
import
com.jz.
common
.entity.MallCustomer
;
import
com.jz.
dm.mall.moduls
.entity.MallCustomer
;
import
java.util.Map
;
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/CompanyAuthServiceImpl.java
View file @
00fbc440
...
...
@@ -3,9 +3,8 @@ import java.math.BigDecimal;
import
com.jz.common.entity.Department
;
import
com.jz.common.entity.FinanceCustomerAssets
;
import
com.jz.
common
.entity.MallCustomer
;
import
com.jz.
dm.mall.moduls
.entity.MallCustomer
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.UserContextUtil
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
import
com.jz.dm.mall.moduls.mapper.DepartmentDao
;
import
com.jz.dm.mall.moduls.mapper.FinanceCustomerAssetsDao
;
...
...
@@ -53,7 +52,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Result
addCompanyData
(
CompanyAddReq
req
)
{
//TODO 获取当前用户ID判断当前用户是否已经关联企业
Long
customerId
=
(
Long
)
UserContextUtil
.
pop
(
"customer_id"
);
// Long customerId = (Long) UserContextUtil.pop("customer_id");
Long
customerId
=
0L
;
if
(
null
==
customerId
){
return
Result
.
error
(
"获取用户信息失败"
);
}
...
...
@@ -78,13 +78,19 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
/**
* 查询企业认证详情
* @param type
* @return
*/
@Override
public
Result
<
Department
>
selectCompany
()
{
public
Result
<
Department
>
selectCompany
(
String
type
)
{
//查询用户判断用户是否认证
// if (){
//
// Long customerId = (Long) UserContextUtil.pop("customer_id");
// if (null ==customerId){
// return Result.error("获取用户信息失败");
// }
// MallCustomer mallCustomer = mallCustomerDao.findById(customerId);
// if (null == mallCustomer){
// return Result.error("用户信息不存在");
// }
return
null
;
}
...
...
@@ -116,7 +122,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
mallCustomer
.
setCustomerId
(
req
.
getCustomerId
());
//用户ID
mallCustomer
.
setDepartmentId
(
departmentInset
.
getDepartmentId
());
mallCustomer
.
setUptTime
(
new
Date
());
mallCustomer
.
setUptPerson
(
req
.
getLoginName
());
//
mallCustomer.setUptPerson(req.getLoginName());
if
(
mallCustomerDao
.
updateById
(
mallCustomer
)
!=
1
){
throw
new
RuntimeException
(
"更新用户企业信息失败"
);
}
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
View file @
00fbc440
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
.
impl
;
import
com.jz.
common
.entity.MallCustomer
;
import
com.jz.
dm.mall.moduls
.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.mapper.MallCustomerDao
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -26,7 +26,6 @@ public class MallCustomerServiceImpl implements MallCustomerService {
*/
@Override
public
MallCustomer
selectByAccount
(
String
username
)
{
return
tMallCustomerDao
.
selectByAccount
(
username
);
}
...
...
pom.xml
View file @
00fbc440
...
...
@@ -206,18 +206,18 @@
<artifactId>
swagger-bootstrap-ui
</artifactId>
<version>
${swagger-bootstrap-ui.version}
</version>
</dependency>
<dependency
>
<groupId>
org.apache.tomcat.embed
</groupId
>
<artifactId>
tomcat-embed-core
</artifactId
>
<version>
${tomcat-embed-core.version}
</version
>
<scope>
compile
</scope
>
</dependency
>
<dependency
>
<groupId>
org.springframework
</groupId
>
<artifactId>
spring-web
</artifactId
>
<version>
${spring-web.version}
</version
>
<scope>
compile
</scope
>
</dependency
>
<!-- <dependency>--
>
<!-- <groupId>org.apache.tomcat.embed</groupId>--
>
<!-- <artifactId>tomcat-embed-core</artifactId>--
>
<!-- <version>${tomcat-embed-core.version}</version>--
>
<!-- <scope>compile</scope>--
>
<!-- </dependency>--
>
<!-- <dependency>--
>
<!-- <groupId>org.springframework</groupId>--
>
<!-- <artifactId>spring-web</artifactId>--
>
<!-- <version>${spring-web.version}</version>--
>
<!-- <scope>compile</scope>--
>
<!-- </dependency>--
>
</dependencies>
</dependencyManagement>
...
...
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