Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
EncryptedFileSystem
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhangshuang
EncryptedFileSystem
Commits
f1005c03
提交
f1005c03
authored
3月 30, 2020
作者:
LJJ
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix user
上级
5e9450da
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
70 行增加
和
4 行删除
+70
-4
UserInit.java
...ion/src/main/java/com/zjty/efs/union/config/UserInit.java
+48
-0
application.properties
efs-union/src/main/resources/application.properties
+1
-1
UserController.java
.../com/zjty/efs/user/subject/controller/UserController.java
+7
-1
UserDao.java
.../src/main/java/com/zjty/efs/user/subject/dao/UserDao.java
+3
-0
UserDo.java
...rc/main/java/com/zjty/efs/user/subject/entity/UserDo.java
+1
-1
UserServiceImpl.java
...m/zjty/efs/user/subject/service/impl/UserServiceImpl.java
+10
-1
没有找到文件。
efs-union/src/main/java/com/zjty/efs/union/config/UserInit.java
0 → 100644
浏览文件 @
f1005c03
package
com
.
zjty
.
efs
.
union
.
config
;
import
com.zjty.efs.misc.util.MD5Untils
;
import
com.zjty.efs.user.subject.dao.UserDao
;
import
com.zjty.efs.user.subject.entity.UserDo
;
import
com.zjty.efs.user.subject.service.UserService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
import
sun.security.provider.MD5
;
import
java.util.Date
;
import
java.util.List
;
/**
*
* user 模块初始化admin
* @author LJJ cnljj1995@gmail.com
* on 2020-03-30
*/
@Slf4j
@Component
public
class
UserInit
implements
CommandLineRunner
{
@Autowired
private
UserService
userService
;
@Autowired
private
UserDao
userDao
;
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
// log.info("删除现有admin账户信息");
// userDao.deleteUserDosByAccount("admin");
List
<
UserDo
>
rs
=
userDao
.
findByAccount
(
"admin"
);
if
(
rs
.
isEmpty
())
{
userDao
.
save
(
new
UserDo
(
null
,
"admin"
,
"123"
,
"admin"
,
"admin"
,
"admin"
,
"admin"
,
"admin"
,
MD5Untils
.
getMD5Str
(
"admin"
),
1
,
"admin"
,
new
Date
()));
return
;
}
UserDo
admin
=
rs
.
get
(
0
);
log
.
info
(
"初始化amdin账户"
);
admin
.
setPassword
(
MD5Untils
.
getMD5Str
(
"admin"
));
userDao
.
save
(
admin
);
log
.
info
(
"初始化admin完成,{}"
,
admin
.
toString
());
}
}
efs-union/src/main/resources/application.properties
浏览文件 @
f1005c03
...
@@ -8,7 +8,7 @@ spring.main.allow-bean-definition-overriding=true
...
@@ -8,7 +8,7 @@ spring.main.allow-bean-definition-overriding=true
spring.datasource.url
=
jdbc:mysql://localhost:3306/ty_efs?useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8
spring.datasource.url
=
jdbc:mysql://localhost:3306/ty_efs?useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.datasource.username
=
root
spring.datasource.username
=
root
spring.datasource.password
=
root
spring.datasource.password
=
ljj123456
# spring.jpa.properties.hibernate.format_sql=true
# spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.ddl-auto
=
update
spring.jpa.hibernate.ddl-auto
=
update
...
...
efs-user/src/main/java/com/zjty/efs/user/subject/controller/UserController.java
浏览文件 @
f1005c03
...
@@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.*;
...
@@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.*;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
static
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMethod
.*;
import
static
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMethod
.
OPTIONS
;
/**
/**
* @author LJJ cnljj1995@gmail.com
* @author LJJ cnljj1995@gmail.com
* on 2020-03-24
* on 2020-03-24
...
@@ -24,6 +27,7 @@ import java.util.List;
...
@@ -24,6 +27,7 @@ import java.util.List;
@AutoDocument
@AutoDocument
@Api
(
tags
=
"用户模块接口"
)
@Api
(
tags
=
"用户模块接口"
)
@Slf4j
@Slf4j
//@CrossOrigin(origins = "*", allowCredentials = "true", methods = {GET, POST, PUT, DELETE, PATCH, OPTIONS})
public
class
UserController
{
public
class
UserController
{
@Autowired
@Autowired
...
@@ -77,7 +81,6 @@ public class UserController {
...
@@ -77,7 +81,6 @@ public class UserController {
@ApiImplicitParam
(
name
=
"id"
,
value
=
"人员id"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"id"
,
value
=
"人员id"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"oPwd"
,
value
=
"老密码"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"oPwd"
,
value
=
"老密码"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"nPwd"
,
value
=
"新密码"
,
dataType
=
"string"
,
paramType
=
"query"
)
@ApiImplicitParam
(
name
=
"nPwd"
,
value
=
"新密码"
,
dataType
=
"string"
,
paramType
=
"query"
)
})
})
public
ResponseEntity
<
UserPwdVo
>
updatePwd
(
@RequestParam
(
value
=
"id"
)
String
id
,
public
ResponseEntity
<
UserPwdVo
>
updatePwd
(
@RequestParam
(
value
=
"id"
)
String
id
,
@RequestParam
(
value
=
"oPwd"
)
String
oPwd
,
@RequestParam
(
value
=
"oPwd"
)
String
oPwd
,
...
@@ -98,8 +101,11 @@ public class UserController {
...
@@ -98,8 +101,11 @@ public class UserController {
})
})
public
ResponseEntity
<
UserDo
>
login
(
@RequestParam
(
value
=
"account"
)
String
username
,
public
ResponseEntity
<
UserDo
>
login
(
@RequestParam
(
value
=
"account"
)
String
username
,
@RequestParam
(
value
=
"password"
)
String
password
)
{
@RequestParam
(
value
=
"password"
)
String
password
)
{
log
.
info
(
"account:{} 登陆"
,
username
);
UserDo
user
=
userService
.
login
(
username
,
password
);
UserDo
user
=
userService
.
login
(
username
,
password
);
if
(
user
.
getName
()
!=
null
)
{
if
(
user
.
getName
()
!=
null
)
{
return
ResponseEntity
.
ok
(
user
);
return
ResponseEntity
.
ok
(
user
);
}
else
{
}
else
{
...
...
efs-user/src/main/java/com/zjty/efs/user/subject/dao/UserDao.java
浏览文件 @
f1005c03
...
@@ -16,4 +16,7 @@ public interface UserDao extends JpaRepository<UserDo, String> {
...
@@ -16,4 +16,7 @@ public interface UserDao extends JpaRepository<UserDo, String> {
List
<
UserDo
>
findByAccount
(
String
account
);
List
<
UserDo
>
findByAccount
(
String
account
);
void
deleteUserDosByAccount
(
String
name
);
}
}
efs-user/src/main/java/com/zjty/efs/user/subject/entity/UserDo.java
浏览文件 @
f1005c03
...
@@ -32,7 +32,7 @@ public class UserDo {
...
@@ -32,7 +32,7 @@ public class UserDo {
@ApiModelProperty
(
value
=
"id"
,
example
=
"jksdhfjks5"
)
@ApiModelProperty
(
value
=
"id"
,
example
=
"jksdhfjks5"
)
@Id
@Id
@GeneratedValue
(
generator
=
"uuid2"
)
@GeneratedValue
(
generator
=
"uuid2"
)
@GenericGenerator
(
name
=
"uuid2"
,
strategy
=
"org.hibernate.id.UUIDGenerator"
)
@GenericGenerator
(
name
=
"uuid2"
,
strategy
=
"org.hibernate.id.UUIDGenerator"
)
private
String
id
;
private
String
id
;
@ApiModelProperty
(
value
=
"用户姓名"
,
example
=
"mcj"
)
@ApiModelProperty
(
value
=
"用户姓名"
,
example
=
"mcj"
)
...
...
efs-user/src/main/java/com/zjty/efs/user/subject/service/impl/UserServiceImpl.java
浏览文件 @
f1005c03
...
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
...
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
/**
/**
* @author LJJ cnljj1995@gmail.com
* @author LJJ cnljj1995@gmail.com
...
@@ -131,6 +132,12 @@ public class UserServiceImpl implements UserService {
...
@@ -131,6 +132,12 @@ public class UserServiceImpl implements UserService {
List
<
UserDo
>
byUsername
=
userDao
.
findByAccount
(
username
);
List
<
UserDo
>
byUsername
=
userDao
.
findByAccount
(
username
);
log
.
info
(
"{}"
,
byUsername
);
log
.
info
(
"{}"
,
byUsername
);
if
(
byUsername
.
size
()
==
1
)
{
if
(
byUsername
.
size
()
==
1
)
{
if
(
byUsername
.
get
(
0
).
getStatus
()
==
0
)
{
log
.
warn
(
"登陆用户被冻结:{}"
,
byUsername
.
get
(
0
).
getAccount
());
return
new
UserDo
();
}
log
.
info
(
"用户存在"
);
log
.
info
(
"用户存在"
);
if
(
byUsername
.
get
(
0
).
getPassword
().
equals
(
MD5Untils
.
getMD5Str
(
password
)))
{
if
(
byUsername
.
get
(
0
).
getPassword
().
equals
(
MD5Untils
.
getMD5Str
(
password
)))
{
return
byUsername
.
get
(
0
);
return
byUsername
.
get
(
0
);
...
@@ -146,7 +153,9 @@ public class UserServiceImpl implements UserService {
...
@@ -146,7 +153,9 @@ public class UserServiceImpl implements UserService {
@Override
@Override
public
UserDo
updatePwd
(
String
id
,
String
oPwd
,
String
nPwd
)
{
public
UserDo
updatePwd
(
String
id
,
String
oPwd
,
String
nPwd
)
{
UserDo
user
=
userDao
.
findById
(
id
).
get
();
Optional
<
UserDo
>
user2
=
userDao
.
findById
(
id
);
UserDo
user
=
user2
.
get
();
if
(!
user
.
getPassword
().
equals
(
MD5Untils
.
getMD5Str
(
oPwd
)))
{
if
(!
user
.
getPassword
().
equals
(
MD5Untils
.
getMD5Str
(
oPwd
)))
{
log
.
warn
(
"密码不对"
);
log
.
warn
(
"密码不对"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论