Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
civil-bigdata
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
civil
civil-bigdata
Commits
8f1741c5
Commit
8f1741c5
authored
Nov 15, 2023
by
杨琪琪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
死亡登记标注死亡
parent
f72bb9ca
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
729 additions
and
548 deletions
+729
-548
api-server/src/main/java/com/zq/api/utils/ApiUtils.java
+18
-6
civil-common-utils/src/main/java/com/zq/common/vo/PageReqVo.java
+20
-10
sys-server/pom.xml
+6
-0
sys-server/src/main/java/com/zq/system/modules/system/dao/ReportDeathDao.java
+15
-0
sys-server/src/main/java/com/zq/system/modules/system/repository/UserRepository.java
+18
-0
sys-server/src/main/java/com/zq/system/modules/system/rest/DeathRegisterController.java
+14
-5
sys-server/src/main/java/com/zq/system/modules/system/rest/SsoController.java
+0
-1
sys-server/src/main/java/com/zq/system/modules/system/rest/UserController.java
+11
-0
sys-server/src/main/java/com/zq/system/modules/system/service/ReportDeathService.java
+5
-1
sys-server/src/main/java/com/zq/system/modules/system/service/SsoService.java
+6
-3
sys-server/src/main/java/com/zq/system/modules/system/service/UserService.java
+2
-0
sys-server/src/main/java/com/zq/system/modules/system/service/impl/ReportDeathImpl.java
+84
-58
sys-server/src/main/java/com/zq/system/modules/system/service/impl/UserServiceImpl.java
+440
-432
sys-server/src/main/resources/mapper/CremationInfoSumMapper.xml
+2
-3
sys-server/src/main/resources/mapper/EnbuzMemberStopMapper.xml
+1
-2
sys-server/src/main/resources/mapper/HdptRstSwmdMapper.xml
+2
-3
sys-server/src/main/resources/mapper/ReportDeathMapper.xml
+85
-24
No files found.
api-server/src/main/java/com/zq/api/utils/ApiUtils.java
View file @
8f1741c5
package
com
.
zq
.
api
.
utils
;
package
com
.
zq
.
api
.
utils
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.io.FileTypeUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.core.io.resource.ClassPathResource
;
import
cn.hutool.core.lang.Console
;
import
cn.hutool.core.util.HashUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.core.util.URLUtil
;
...
@@ -19,11 +25,17 @@ import com.zq.common.encrypt.EncryptUtils;
...
@@ -19,11 +25,17 @@ import com.zq.common.encrypt.EncryptUtils;
import
com.zq.common.encrypt.RsaUtils
;
import
com.zq.common.encrypt.RsaUtils
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.common.vo.ResultVo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.ognl.enhance.ContextClassLoader
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
@Component
@Component
...
@@ -235,9 +247,9 @@ public class ApiUtils {
...
@@ -235,9 +247,9 @@ public class ApiUtils {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
appId
=
"
d469c70c4e8b
11ecaa2900163e1475c7"
;
String
appId
=
"
c817c5585896
11ecaa2900163e1475c7"
;
String
apiNo
=
IdUtil
.
simpleUUID
();
String
apiNo
=
IdUtil
.
simpleUUID
();
String
method
=
"getS
ingle
UserInfo"
;
String
method
=
"getS
so
UserInfo"
;
String
timestamp
=
System
.
currentTimeMillis
()
+
""
;
String
timestamp
=
System
.
currentTimeMillis
()
+
""
;
String
version
=
"1.0.0"
;
String
version
=
"1.0.0"
;
String
bizContent
=
"{}"
;
//JSON字符串
String
bizContent
=
"{}"
;
//JSON字符串
...
@@ -264,14 +276,14 @@ public class ApiUtils {
...
@@ -264,14 +276,14 @@ public class ApiUtils {
for
(
Map
.
Entry
<
String
,
String
>
entry
:
signTreeMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
signTreeMap
.
entrySet
())
{
src
.
append
(
entry
.
getKey
()).
append
(
"="
).
append
(
entry
.
getValue
()).
append
(
"&"
);
src
.
append
(
entry
.
getKey
()).
append
(
"="
).
append
(
entry
.
getValue
()).
append
(
"&"
);
}
}
src
.
append
(
"key="
).
append
(
"
ce8fcdd1ae6e42efaabe8819e3fbd8da
"
);
src
.
append
(
"key="
).
append
(
"
82bb8e368055403f91bd67992db17800
"
);
params
.
put
(
"sign"
,
MD5
.
create
().
digestHex
(
src
.
toString
()).
toUpperCase
());
params
.
put
(
"sign"
,
MD5
.
create
().
digestHex
(
src
.
toString
()).
toUpperCase
());
HttpRequest
request
=
HttpRequest
.
post
(
"http://1
27.0.0.1
:9888/api/action"
)
HttpRequest
request
=
HttpRequest
.
post
(
"http://1
06.52.179.107
:9888/api/action"
)
.
header
(
"appId"
,
appId
)
.
header
(
"appId"
,
appId
)
.
header
(
"appSecret"
,
"
e209eb5e4e8b
11ecaa2900163e1475c7"
)
.
header
(
"appSecret"
,
"
1f6baf5b5897
11ecaa2900163e1475c7"
)
.
header
(
"Authorization"
,
"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ
hZG1pbiIsImF1dGgiOiJhZG1pbiIsImp0aSI6IjY4OTJlY2E2OTAwNzRjZDRhOGI0NjJlNDM5NDNhZmI1In0.AB77eTqqiBsSunVChqfAx9jB8FN58I7fph1Dw-RfYEVWvN-U2AQYYvuMlCczsiBbduL0vCNALjBzo_1jjKlAP
g"
)
.
header
(
"Authorization"
,
"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ
0ZXN0MTIwODE1MzQiLCJhdXRoIjoiIiwianRpIjoiZjc4NmM4Nzk0OGQ1NDA3YWIzMjYyNTNmNDk3YzUzZjUifQ.-_ty93y4sIQu4Lx1lQM_819Ay8cMtYHMlKPKA6n12E9RwJIqmI1OMzU9G5ANSPYgo22jdL1r23heHElBJEEuB
g"
)
.
contentType
(
"application/x-www-form-urlencoded"
)
.
contentType
(
"application/x-www-form-urlencoded"
)
.
formStr
(
params
);
.
formStr
(
params
);
...
...
civil-common-utils/src/main/java/com/zq/common/vo/PageReqVo.java
View file @
8f1741c5
...
@@ -24,18 +24,13 @@ public class PageReqVo {
...
@@ -24,18 +24,13 @@ public class PageReqVo {
@ApiModelProperty
(
"每页记录条数"
)
@ApiModelProperty
(
"每页记录条数"
)
private
int
size
=
DEFAULT_SIZE
;
private
int
size
=
DEFAULT_SIZE
;
@ApiModelProperty
(
value
=
"排序字段名"
,
allowEmptyValue
=
true
)
private
String
sort
;
private
String
sort
;
@ApiModelProperty
(
value
=
"排序方向"
,
allowableValues
=
"asc,desc"
,
allowEmptyValue
=
true
)
private
String
dir
;
private
String
dir
;
public
static
PageReqVo
of
(
int
page
,
int
size
)
{
private
int
start
;
PageReqVo
pageReqVo
=
new
PageReqVo
();
pageReqVo
.
setPage
(
page
);
private
int
end
;
pageReqVo
.
setSize
(
size
);
return
pageReqVo
;
}
public
PageReqVo
()
{
public
PageReqVo
()
{
}
}
...
@@ -77,4 +72,20 @@ public class PageReqVo {
...
@@ -77,4 +72,20 @@ public class PageReqVo {
public
void
setDir
(
String
dir
)
{
public
void
setDir
(
String
dir
)
{
this
.
dir
=
dir
;
this
.
dir
=
dir
;
}
}
}
\ No newline at end of file
public
int
getEnd
()
{
return
getPage
()
*
getSize
();
}
public
void
setEnd
(
int
end
)
{
this
.
end
=
end
;
}
public
int
getStart
()
{
return
(
getPage
()
-
1
)
*
getSize
();
}
public
void
setStart
(
int
start
)
{
this
.
start
=
start
;
}
}
sys-server/pom.xml
View file @
8f1741c5
...
@@ -192,6 +192,12 @@
...
@@ -192,6 +192,12 @@
<artifactId>
hutool-all
</artifactId>
<artifactId>
hutool-all
</artifactId>
<version>
5.7.16
</version>
<version>
5.7.16
</version>
</dependency>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.7.18
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
sys-server/src/main/java/com/zq/system/modules/system/dao/ReportDeathDao.java
View file @
8f1741c5
...
@@ -3,13 +3,28 @@ package com.zq.system.modules.system.dao;
...
@@ -3,13 +3,28 @@ package com.zq.system.modules.system.dao;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zq.common.constant.DBName
;
import
com.zq.common.constant.DBName
;
import
com.zq.system.modules.system.domain.vo.ReportDeathVo
;
import
com.zq.system.modules.system.entity.ReportDeath
;
import
com.zq.system.modules.system.entity.ReportDeath
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
@Repository
@DS
(
DBName
.
OZT
)
@DS
(
DBName
.
OZT
)
public
interface
ReportDeathDao
extends
BaseMapper
<
ReportDeath
>
{
public
interface
ReportDeathDao
extends
BaseMapper
<
ReportDeath
>
{
ReportDeath
selectByIdCard
(
String
idCard
);
ReportDeath
selectByIdCard
(
String
idCard
);
List
<
ReportDeathVo
>
selectAllDeaths
(
ReportDeathVo
vo
);
int
selectAllCount
(
ReportDeathVo
vo
);
ReportDeath
selectByNameOrIdcard
(
ReportDeathVo
vo
);
int
insertInTo
(
ReportDeath
death
);
List
<
ReportDeathVo
>
getDeathByName
(
ReportDeathVo
vo
);
int
updateDeath
(
ReportDeath
death
);
}
}
sys-server/src/main/java/com/zq/system/modules/system/repository/UserRepository.java
View file @
8f1741c5
...
@@ -20,6 +20,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
...
@@ -20,6 +20,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -59,6 +60,7 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
...
@@ -59,6 +60,7 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
* @param lastPasswordResetTime /
* @param lastPasswordResetTime /
*/
*/
@Modifying
@Modifying
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Query
(
value
=
"update sys_user set password = ?2 , pwd_reset_time = ?3 where username = ?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"update sys_user set password = ?2 , pwd_reset_time = ?3 where username = ?1"
,
nativeQuery
=
true
)
void
updatePass
(
String
username
,
String
pass
,
Date
lastPasswordResetTime
);
void
updatePass
(
String
username
,
String
pass
,
Date
lastPasswordResetTime
);
...
@@ -128,4 +130,20 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
...
@@ -128,4 +130,20 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
@Query
(
value
=
"SELECT count(1) FROM sys_user u, sys_users_roles r WHERE "
+
@Query
(
value
=
"SELECT count(1) FROM sys_user u, sys_users_roles r WHERE "
+
"u.user_id = r.user_id AND r.role_id in ?1"
,
nativeQuery
=
true
)
"u.user_id = r.user_id AND r.role_id in ?1"
,
nativeQuery
=
true
)
int
countByRoles
(
Set
<
Long
>
ids
);
int
countByRoles
(
Set
<
Long
>
ids
);
/**
* 根据电话查询
* @param phone/
* @return /
*/
@Query
(
value
=
"SELECT * FROM sys_user u WHERE u.phone= ?1"
,
nativeQuery
=
true
)
User
findBySysname
(
String
phone
);
/**
* 根据电话查询
* @param currentUsername/
* @return /
*/
@Query
(
value
=
"SELECT * FROM sys_user u WHERE u.username= ?1"
,
nativeQuery
=
true
)
User
findByname
(
String
currentUsername
);
}
}
sys-server/src/main/java/com/zq/system/modules/system/rest/DeathRegisterController.java
View file @
8f1741c5
...
@@ -13,10 +13,7 @@ import com.zq.system.modules.system.service.ReportDeathService;
...
@@ -13,10 +13,7 @@ import com.zq.system.modules.system.service.ReportDeathService;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -45,10 +42,16 @@ public class DeathRegisterController {
...
@@ -45,10 +42,16 @@ public class DeathRegisterController {
@ApiOperation
(
"获取死亡列表"
)
@ApiOperation
(
"获取死亡列表"
)
@PostMapping
(
value
=
"/getDeathList"
)
@PostMapping
(
value
=
"/getDeathList"
)
public
ResultVo
<
PageVo
<
ReportDeath
>>
getDeathList
(
@RequestBody
ReportDeathVo
vo
)
{
public
ResultVo
<
PageVo
<
ReportDeath
Vo
>>
getDeathList
(
@RequestBody
ReportDeathVo
vo
)
{
return
ResultVo
.
success
(
reportDeathService
.
getDeathList
(
vo
));
return
ResultVo
.
success
(
reportDeathService
.
getDeathList
(
vo
));
}
}
@ApiOperation
(
"查询死亡记录"
)
@PostMapping
(
value
=
"/getDeathByName"
)
public
ResultVo
getDeathByName
(
@RequestBody
ReportDeathVo
vo
)
{
return
ResultVo
.
success
(
reportDeathService
.
getDeathByName
(
vo
));
}
@ApiOperation
(
"获取死亡人详情"
)
@ApiOperation
(
"获取死亡人详情"
)
@AnonymousPostMapping
(
value
=
"/getDeathDetail"
)
@AnonymousPostMapping
(
value
=
"/getDeathDetail"
)
public
ResultVo
getDeathDetail
(
@RequestBody
ReportDeathVo
vo
)
{
public
ResultVo
getDeathDetail
(
@RequestBody
ReportDeathVo
vo
)
{
...
@@ -61,5 +64,11 @@ public class DeathRegisterController {
...
@@ -61,5 +64,11 @@ public class DeathRegisterController {
return
ResultVo
.
success
(
reportDeathService
.
updateDeath
(
vo
));
return
ResultVo
.
success
(
reportDeathService
.
updateDeath
(
vo
));
}
}
@ApiOperation
(
"是否能进入死亡登记系统"
)
@GetMapping
(
value
=
"/inSysDeath"
)
public
ResultVo
inSysDeath
()
{
return
ResultVo
.
success
(
reportDeathService
.
inSysDeath
());
}
}
}
sys-server/src/main/java/com/zq/system/modules/system/rest/SsoController.java
View file @
8f1741c5
package
com
.
zq
.
system
.
modules
.
system
.
rest
;
package
com
.
zq
.
system
.
modules
.
system
.
rest
;
import
cn.hutool.core.lang.tree.TreeUtil
;
import
com.zq.common.annotation.rest.AnonymousGetMapping
;
import
com.zq.common.annotation.rest.AnonymousGetMapping
;
import
com.zq.common.annotation.rest.AnonymousPostMapping
;
import
com.zq.common.annotation.rest.AnonymousPostMapping
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.config.redis.RedisUtils
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/rest/UserController.java
View file @
8f1741c5
...
@@ -180,6 +180,17 @@ public class UserController {
...
@@ -180,6 +180,17 @@ public class UserController {
return
ResultVo
.
success
();
return
ResultVo
.
success
();
}
}
@ApiOperation
(
"重置sys登录密码"
)
@PostMapping
(
value
=
"/resetPassw"
)
@AnonymousAccess
public
ResultVo
resetPassw
(
@RequestBody
LoginVo
vo
)
{
AssertUtils
.
hasText
(
vo
.
getPhone
(),
"手机号不能为空"
);
AssertUtils
.
isTrue
(
ValidateUtil
.
isMobilePhoneNo
(
vo
.
getPhone
()),
"手机号格式不正确"
);
AssertUtils
.
hasText
(
vo
.
getVerifyCode
(),
"请输入验证码"
);
userService
.
resetPassword2
(
vo
);
return
ResultVo
.
success
();
}
@ApiOperation
(
"修改头像"
)
@ApiOperation
(
"修改头像"
)
@PostMapping
(
value
=
"/updateAvatar"
)
@PostMapping
(
value
=
"/updateAvatar"
)
public
ResponseEntity
<
Object
>
updateAvatar
(
@RequestParam
MultipartFile
avatar
)
{
public
ResponseEntity
<
Object
>
updateAvatar
(
@RequestParam
MultipartFile
avatar
)
{
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/ReportDeathService.java
View file @
8f1741c5
...
@@ -12,9 +12,13 @@ public interface ReportDeathService {
...
@@ -12,9 +12,13 @@ public interface ReportDeathService {
Object
importDeath
(
MultipartFile
file
);
Object
importDeath
(
MultipartFile
file
);
PageVo
<
ReportDeath
>
getDeathList
(
ReportDeathVo
vo
);
PageVo
<
ReportDeath
Vo
>
getDeathList
(
ReportDeathVo
vo
);
Object
getDeathDetail
(
ReportDeathVo
vo
);
Object
getDeathDetail
(
ReportDeathVo
vo
);
ResultVo
updateDeath
(
ReportDeathVo
vo
);
ResultVo
updateDeath
(
ReportDeathVo
vo
);
ResultVo
inSysDeath
();
ResultVo
getDeathByName
(
ReportDeathVo
vo
);
}
}
sys-server/src/main/java/com/zq/system/modules/system/service/SsoService.java
View file @
8f1741c5
...
@@ -24,6 +24,7 @@ import com.zq.system.modules.system.dao.SysInfoDao;
...
@@ -24,6 +24,7 @@ import com.zq.system.modules.system.dao.SysInfoDao;
import
com.zq.system.modules.system.domain.Job
;
import
com.zq.system.modules.system.domain.Job
;
import
com.zq.system.modules.system.domain.Role
;
import
com.zq.system.modules.system.domain.Role
;
import
com.zq.system.modules.system.domain.User
;
import
com.zq.system.modules.system.domain.User
;
import
com.zq.system.modules.system.domain.vo.ReportDeathVo
;
import
com.zq.system.modules.system.domain.vo.SsoLoginVo
;
import
com.zq.system.modules.system.domain.vo.SsoLoginVo
;
import
com.zq.system.modules.system.domain.vo.SsoRegisterVo
;
import
com.zq.system.modules.system.domain.vo.SsoRegisterVo
;
import
com.zq.system.modules.system.entity.AreaCode
;
import
com.zq.system.modules.system.entity.AreaCode
;
...
@@ -246,12 +247,14 @@ public class SsoService {
...
@@ -246,12 +247,14 @@ public class SsoService {
SysInfo
sysInfo
=
sysInfoDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
SysInfo
.
builder
().
appId
(
appId
).
build
()));
SysInfo
sysInfo
=
sysInfoDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
SysInfo
.
builder
().
appId
(
appId
).
build
()));
BindUserInfo
bindUserInfo
=
blindUserInfoDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
BindUserInfo
.
builder
().
sysId
(
sysInfo
.
getId
()).
userId
(
adminContext
.
getUserId
()).
build
()));
AssertUtils
.
notNull
(
bindUserInfo
,
501
,
"用户未绑定该系统"
);
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
List
<
BindUserInfo
>
bindUserInfos
=
blindUserInfoDao
.
selectList
(
Wrappers
.
lambdaQuery
(
BindUserInfo
.
builder
().
sysId
(
sysInfo
.
getId
()).
userId
(
adminContext
.
getUserId
()).
build
()));
AssertUtils
.
notNull
(
bindUserInfos
.
size
()==
0
,
501
,
"用户未绑定该系统"
);
for
(
BindUserInfo
bindUserInfo:
bindUserInfos
)
{
data
.
put
(
"userId"
,
bindUserInfo
.
getSystemUserId
());
data
.
put
(
"userId"
,
bindUserInfo
.
getSystemUserId
());
data
.
put
(
"username"
,
bindUserInfo
.
getSystemUserName
());
data
.
put
(
"username"
,
bindUserInfo
.
getSystemUserName
());
}
return
data
;
return
data
;
}
}
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/UserService.java
View file @
8f1741c5
...
@@ -165,4 +165,6 @@ public interface UserService {
...
@@ -165,4 +165,6 @@ public interface UserService {
* @return
* @return
*/
*/
ApiTokenVo
passwdLogin
(
LoginVo
vo
);
ApiTokenVo
passwdLogin
(
LoginVo
vo
);
void
resetPassword2
(
LoginVo
vo
);
}
}
sys-server/src/main/java/com/zq/system/modules/system/service/impl/ReportDeathImpl.java
View file @
8f1741c5
...
@@ -5,12 +5,8 @@ import cn.hutool.core.convert.Convert;
...
@@ -5,12 +5,8 @@ import cn.hutool.core.convert.Convert;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zq.common.exception.BusinessException
;
import
com.zq.common.exception.BusinessException
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.PagingUtils
;
import
com.zq.common.vo.PageVo
;
import
com.zq.common.vo.PageVo
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.system.modules.system.dao.CremationInfoSumDao
;
import
com.zq.system.modules.system.dao.CremationInfoSumDao
;
...
@@ -25,7 +21,6 @@ import com.zq.system.modules.system.service.ReportDeathService;
...
@@ -25,7 +21,6 @@ import com.zq.system.modules.system.service.ReportDeathService;
import
com.zq.system.modules.system.service.SsoService
;
import
com.zq.system.modules.system.service.SsoService
;
import
com.zq.system.utils.SecurityUtils
;
import
com.zq.system.utils.SecurityUtils
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -45,13 +40,12 @@ public class ReportDeathImpl implements ReportDeathService {
...
@@ -45,13 +40,12 @@ public class ReportDeathImpl implements ReportDeathService {
private
final
HdptRstSwmdDao
hdptRstSwmdDao
;
private
final
HdptRstSwmdDao
hdptRstSwmdDao
;
@Override
@Override
public
ResultVo
save
(
ReportDeathVo
vo
)
{
public
ResultVo
save
(
ReportDeathVo
vo
)
{
ReportDeath
Death
=
reportDeathDao
.
selectByIdCard
(
vo
.
getIdCard
());
ReportDeath
Death
=
reportDeathDao
.
selectByIdCard
(
vo
.
getIdCard
());
if
(
Death
!=
null
)
{
if
(
Death
!=
null
)
{
return
ResultVo
.
fail
(
"该死者已重复上报"
);
return
ResultVo
.
fail
(
"该死者已重复上报"
);
}
else
{
}
else
{
ReportDeath
reportDeath
=
new
ReportDeath
();
ReportDeath
reportDeath
=
new
ReportDeath
();
reportDeath
.
setName
(
vo
.
getName
());
reportDeath
.
setName
(
vo
.
getName
());
reportDeath
.
setIdCard
(
vo
.
getIdCard
());
reportDeath
.
setIdCard
(
vo
.
getIdCard
());
...
@@ -92,75 +86,107 @@ public class ReportDeathImpl implements ReportDeathService {
...
@@ -92,75 +86,107 @@ public class ReportDeathImpl implements ReportDeathService {
reportDeath
.
setUserArea
(
user
.
getUserArea
());
reportDeath
.
setUserArea
(
user
.
getUserArea
());
reportDeath
.
setDeathType
(
"1"
);
reportDeath
.
setDeathType
(
"1"
);
ReportDeath
reportDeaths
=
reportDeathDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
ReportDeath
.
builder
().
idCard
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
2
))).
build
()));
ReportDeath
reportDeaths
=
reportDeathDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
ReportDeath
.
builder
().
idCard
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
2
))).
build
()));
if
(
reportDeaths
!=
null
)
{
if
(
reportDeaths
!=
null
)
{
return
"已上报过该死者"
+
reportDeaths
.
getName
()+
"信息"
;
return
"已上报过该死者"
+
reportDeaths
.
getName
()
+
"信息"
;
}
else
{
}
else
{
reportDeathDao
.
insert
(
reportDeath
);
reportDeathDao
.
insert
(
reportDeath
);
}
}
}
}
return
null
;
return
null
;
}
}
@Override
@Override
public
PageVo
<
ReportDeath
>
getDeathList
(
ReportDeathVo
vo
)
{
public
PageVo
<
ReportDeath
Vo
>
getDeathList
(
ReportDeathVo
vo
)
{
L
ambdaQueryWrapper
<
ReportDeath
>
lambdaQuery
=
Wrappers
.
lambdaQuery
(
ReportDeath
.
builder
().
build
()
);
L
ist
<
ReportDeathVo
>
list
=
reportDeathDao
.
selectAllDeaths
(
vo
);
i
f
(
StringUtils
.
isNotBlank
(
vo
.
getIdCard
())){
i
nt
i
=
reportDeathDao
.
selectAllCount
(
vo
);
lambdaQuery
.
like
(
ReportDeath:
:
getIdCard
,
vo
.
getIdCard
()
);
PageVo
<
ReportDeathVo
>
p
=
new
PageVo
<
ReportDeathVo
>(
);
}
if
(
vo
.
getPage
()
-
1
==
0
)
{
if
(
StringUtils
.
isNotBlank
(
vo
.
getName
())){
vo
.
setStart
(
0
);
lambdaQuery
.
like
(
ReportDeath:
:
getName
,
vo
.
getNam
e
());
vo
.
setEnd
(
vo
.
getPage
()
*
vo
.
getSiz
e
());
}
}
else
{
if
(
StringUtils
.
isNotBlank
(
vo
.
getDeathType
()))
{
vo
.
setStart
((
vo
.
getPage
()
-
1
)
*
vo
.
getSize
());
lambdaQuery
.
like
(
ReportDeath:
:
getDeathType
,
vo
.
getDeathTyp
e
());
vo
.
setEnd
(
vo
.
getPage
()
*
vo
.
getSiz
e
());
}
}
PageVo
<
ReportDeath
>
paging
=
PagingUtils
.
paging
(
vo
,
reportDeathDao
,
lambdaQuery
);
p
.
setRows
(
list
);
return
paging
;
p
.
setStart
(
vo
.
getPage
());
p
.
setSize
(
vo
.
getSize
());
p
.
setTotal
(
i
);
return
p
;
}
}
@Override
@Override
public
Object
getDeathDetail
(
ReportDeathVo
vo
)
{
public
Object
getDeathDetail
(
ReportDeathVo
vo
)
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
CremationInfoSum
cremationInfoSum
=
cremationInfoSumDao
.
selectByNameOrIdcard
(
vo
);
switch
(
vo
.
getSource
())
{
EnbuzMemberStop
enbuzMemberStop
=
enbuzMemberStopDao
.
selectByNameOrIdcard
(
vo
);
case
"1"
:
HdptRstSwmd
hdptRstSwmd
=
hdptRstSwmdDao
.
selectByNameOrIdcard
(
vo
);
EnbuzMemberStop
enbuzMemberStop
=
enbuzMemberStopDao
.
selectByNameOrIdcard
(
vo
);
if
(
cremationInfoSum
==
null
&&
enbuzMemberStop
==
null
&&
hdptRstSwmd
==
null
){
map
.
put
(
"enbuzMemberStop"
,
enbuzMemberStop
);
return
"未查到该死者信息"
;
break
;
}
else
{
case
"2"
:
map
.
put
(
"此数据来源殡葬火化库"
,
cremationInfoSum
);
CremationInfoSum
cremationInfoSum
=
cremationInfoSumDao
.
selectByNameOrIdcard
(
vo
);
map
.
put
(
"此数据来源死亡上报小程序(低保)"
,
enbuzMemberStop
);
map
.
put
(
"cremationInfoSum"
,
cremationInfoSum
);
map
.
put
(
"此数据来源共享平台死亡记录数"
,
hdptRstSwmd
);
break
;
case
"3"
:
HdptRstSwmd
hdptRstSwmd
=
hdptRstSwmdDao
.
selectByNameOrIdcard
(
vo
);
map
.
put
(
"hdptRstSwmd"
,
hdptRstSwmd
);
break
;
case
"4"
:
ReportDeath
death
=
reportDeathDao
.
selectByNameOrIdcard
(
vo
);
map
.
put
(
"death"
,
death
);
default
:
map
.
put
(
"list"
,
"无此人具体数据"
);
}
}
return
map
;
return
map
;
}
}
@Override
@Override
public
ResultVo
updateDeath
(
ReportDeathVo
vo
)
{
public
ResultVo
updateDeath
(
ReportDeathVo
vo
)
{
ReportDeath
reportDeath1
=
reportDeathDao
.
selectByIdCard
(
vo
.
getIdCard
());
ReportDeath
death
=
new
ReportDeath
();
int
i
=
0
;
User
user
=
userRepository
.
findByname
(
SecurityUtils
.
getCurrentUsername
());
death
.
setName
(
vo
.
getName
().
trim
());
death
.
setIdCard
(
vo
.
getIdCard
());
death
.
setDeathPlace
(
vo
.
getDeathPlace
());
death
.
setDeathReason
(
vo
.
getDeathReason
());
death
.
setDeathDate
(
vo
.
getDeathDate
());
death
.
setDeathType
(
vo
.
getDeathType
());
death
.
setNotes
(
vo
.
getNotes
());
death
.
setSource
(
vo
.
getSource
());
death
.
setUserArea
(
user
.
getUserArea
());
death
.
setUserName
(
user
.
getUsername
());
death
.
setUpdateTime
(
DateUtil
.
date
());
if
(
reportDeath1
==
null
)
{
i
=
reportDeathDao
.
insertInTo
(
death
);
}
else
{
i
=
reportDeathDao
.
updateDeath
(
death
);
}
return
ResultVo
.
success
(
i
>
0
?
"标注成功"
:
"标注失败"
);
}
@Override
public
ResultVo
inSysDeath
()
{
List
<
BindUserInfo
>
bindSysList
=
ssoService
.
getBindSysList
();
List
<
BindUserInfo
>
bindSysList
=
ssoService
.
getBindSysList
();
for
(
BindUserInfo
bindUser:
bindSysList
)
{
String
sysId
=
null
;
if
(
bindUser
.
getSysId
()==
3
||
bindUser
.
getSysId
()==
9
||
bindUser
.
getSysId
()==
4
)
{
for
(
BindUserInfo
bindUser
:
bindSysList
)
{
User
user
=
userRepository
.
findByUsername
(
SecurityUtils
.
getCurrentUsername
());
sysId
=
bindUser
.
getSysId
().
toString
();
ReportDeath
reportDeath
=
reportDeathDao
.
selectById
(
vo
.
getId
());
if
(
sysId
.
equals
(
"3"
)
||
sysId
.
equals
(
"9"
)
||
sysId
.
equals
(
"4"
))
{
AssertUtils
.
notNull
(
reportDeath
,
"无此条记录"
);
return
ResultVo
.
success
();
ReportDeath
death
=
new
ReportDeath
();
death
.
setId
(
vo
.
getId
());
death
.
setName
(
vo
.
getName
());
death
.
setIdCard
(
vo
.
getIdCard
());
death
.
setDeathPlace
(
vo
.
getDeathPlace
());
death
.
setDeathReason
(
vo
.
getDeathReason
());
death
.
setDeathDate
(
vo
.
getDeathDate
());
death
.
setDeathType
(
vo
.
getDeathType
());
death
.
setNotes
(
vo
.
getNotes
());
death
.
setSource
(
vo
.
getSource
());
death
.
setUserArea
(
user
.
getUserArea
());
death
.
setUserName
(
reportDeath
.
getUserName
());
death
.
setUpdateTime
(
DateUtil
.
date
());
reportDeathDao
.
updateById
(
death
);
return
ResultVo
.
success
(
"标注成功"
);
}
else
{
return
ResultVo
.
fail
(
"无权限修改"
);
}
}
}
}
return
ResultVo
.
success
();
return
ResultVo
.
fail
(
"抱歉您目前无权限进入此系统"
);
}
@Override
public
ResultVo
getDeathByName
(
ReportDeathVo
vo
)
{
List
<
ReportDeathVo
>
list
=
reportDeathDao
.
getDeathByName
(
vo
);
if
(
list
.
size
()
==
0
)
{
return
ResultVo
.
fail
(
"抱歉查无此人信息!"
);
}
else
{
return
ResultVo
.
success
(
list
);
}
}
}
}
}
sys-server/src/main/java/com/zq/system/modules/system/service/impl/UserServiceImpl.java
View file @
8f1741c5
/*
/*
* Copyright 2019-2020 Zheng Jie
* Copyright 2019-2020 Zheng Jie
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
package
com
.
zq
.
system
.
modules
.
system
.
service
.
impl
;
package
com
.
zq
.
system
.
modules
.
system
.
service
.
impl
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.config.security.ApiTokenUtils
;
import
com.zq.common.config.security.ApiTokenUtils
;
import
com.zq.common.constant.SystemName
;
import
com.zq.common.constant.SystemName
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.StringUtils
;
import
com.zq.common.utils.StringUtils
;
import
com.zq.common.utils.UploadUtils
;
import
com.zq.common.utils.UploadUtils
;
import
com.zq.common.vo.ApiTokenVo
;
import
com.zq.common.vo.ApiTokenVo
;
import
com.zq.system.config.CacheKeys
;
import
com.zq.system.config.CacheKeys
;
import
com.zq.system.config.FileProperties
;
import
com.zq.system.config.FileProperties
;
import
com.zq.system.exception.EntityExistException
;
import
com.zq.system.exception.EntityExistException
;
import
com.zq.system.exception.EntityNotFoundException
;
import
com.zq.system.exception.EntityNotFoundException
;
import
com.zq.system.modules.system.dao.PfuserDao
;
import
com.zq.system.modules.system.dao.PfuserDao
;
import
com.zq.system.modules.system.domain.Job
;
import
com.zq.system.modules.system.domain.Job
;
import
com.zq.system.modules.system.domain.Role
;
import
com.zq.system.modules.system.domain.Role
;
import
com.zq.system.modules.system.domain.User
;
import
com.zq.system.modules.system.domain.User
;
import
com.zq.system.modules.system.domain.vo.LoginVo
;
import
com.zq.system.modules.system.domain.vo.LoginVo
;
import
com.zq.system.modules.system.entity.Pfuser
;
import
com.zq.system.modules.system.entity.Pfuser
;
import
com.zq.system.modules.system.repository.DeptRepository
;
import
com.zq.system.modules.system.repository.DeptRepository
;
import
com.zq.system.modules.system.repository.JobRepository
;
import
com.zq.system.modules.system.repository.JobRepository
;
import
com.zq.system.modules.system.repository.RoleRepository
;
import
com.zq.system.modules.system.repository.RoleRepository
;
import
com.zq.system.modules.system.repository.UserRepository
;
import
com.zq.system.modules.system.repository.UserRepository
;
import
com.zq.system.modules.system.service.OnlineUserService
;
import
com.zq.system.modules.system.service.OnlineUserService
;
import
com.zq.system.modules.system.service.UserCacheClean
;
import
com.zq.system.modules.system.service.UserCacheClean
;
import
com.zq.system.modules.system.service.UserService
;
import
com.zq.system.modules.system.service.UserService
;
import
com.zq.system.modules.system.service.dto.JobSmallDto
;
import
com.zq.system.modules.system.service.dto.JobSmallDto
;
import
com.zq.system.modules.system.service.dto.RoleSmallDto
;
import
com.zq.system.modules.system.service.dto.RoleSmallDto
;
import
com.zq.system.modules.system.service.dto.UserDto
;
import
com.zq.system.modules.system.service.dto.UserDto
;
import
com.zq.system.modules.system.service.dto.UserQueryCriteria
;
import
com.zq.system.modules.system.service.dto.UserQueryCriteria
;
import
com.zq.system.modules.system.service.mapstruct.UserMapper
;
import
com.zq.system.modules.system.service.mapstruct.UserMapper
;
import
com.zq.system.utils.*
;
import
com.zq.system.utils.*
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
* @date 2018-11-23
* @date 2018-11-23
*/
*/
@Slf4j
@Slf4j
@Service
@Service
@RequiredArgsConstructor
@RequiredArgsConstructor
@CacheConfig
(
cacheNames
=
"user"
)
@CacheConfig
(
cacheNames
=
"user"
)
public
class
UserServiceImpl
implements
UserService
{
public
class
UserServiceImpl
implements
UserService
{
private
final
UserRepository
userRepository
;
private
final
UserRepository
userRepository
;
private
final
UserMapper
userMapper
;
private
final
UserMapper
userMapper
;
private
final
FileProperties
properties
;
private
final
FileProperties
properties
;
private
final
RedisUtils
redisUtils
;
private
final
RedisUtils
redisUtils
;
private
final
UserCacheClean
userCacheClean
;
private
final
UserCacheClean
userCacheClean
;
private
final
OnlineUserService
onlineUserService
;
private
final
OnlineUserService
onlineUserService
;
private
final
PfuserDao
pfuserDao
;
private
final
PfuserDao
pfuserDao
;
private
final
PasswordEncoder
passwordEncoder
;
private
final
PasswordEncoder
passwordEncoder
;
private
final
DeptRepository
deptRepository
;
private
final
DeptRepository
deptRepository
;
private
final
RoleRepository
roleRepository
;
private
final
RoleRepository
roleRepository
;
private
final
JobRepository
jobRepository
;
private
final
JobRepository
jobRepository
;
@Override
@Override
public
Object
queryAll
(
UserQueryCriteria
criteria
,
Pageable
pageable
)
{
public
Object
queryAll
(
UserQueryCriteria
criteria
,
Pageable
pageable
)
{
Page
<
User
>
page
=
userRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
Page
<
User
>
page
=
userRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
userMapper:
:
toDto
));
return
PageUtil
.
toPage
(
page
.
map
(
userMapper:
:
toDto
));
}
}
@Override
@Override
public
List
<
UserDto
>
queryAll
(
UserQueryCriteria
criteria
)
{
public
List
<
UserDto
>
queryAll
(
UserQueryCriteria
criteria
)
{
List
<
User
>
users
=
userRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
));
List
<
User
>
users
=
userRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
));
return
userMapper
.
toDto
(
users
);
return
userMapper
.
toDto
(
users
);
}
}
@Override
@Override
@Cacheable
(
key
=
"'id:' + #p0"
)
@Cacheable
(
key
=
"'id:' + #p0"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
UserDto
findById
(
long
id
)
{
public
UserDto
findById
(
long
id
)
{
User
user
=
userRepository
.
findById
(
id
).
orElseGet
(
User:
:
new
);
User
user
=
userRepository
.
findById
(
id
).
orElseGet
(
User:
:
new
);
ValidationUtil
.
isNull
(
user
.
getId
(),
"User"
,
"id"
,
id
);
ValidationUtil
.
isNull
(
user
.
getId
(),
"User"
,
"id"
,
id
);
return
userMapper
.
toDto
(
user
);
return
userMapper
.
toDto
(
user
);
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
create
(
User
resources
)
{
public
void
create
(
User
resources
)
{
if
(
userRepository
.
findByUsername
(
resources
.
getUsername
())
!=
null
)
{
if
(
userRepository
.
findByUsername
(
resources
.
getUsername
())
!=
null
)
{
throw
new
EntityExistException
(
User
.
class
,
"username"
,
resources
.
getUsername
());
throw
new
EntityExistException
(
User
.
class
,
"username"
,
resources
.
getUsername
());
}
}
if
(
StringUtils
.
isNotBlank
(
resources
.
getEmail
())
&&
userRepository
.
findByEmail
(
resources
.
getEmail
())
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
resources
.
getEmail
())
&&
userRepository
.
findByEmail
(
resources
.
getEmail
())
!=
null
)
{
throw
new
EntityExistException
(
User
.
class
,
"email"
,
resources
.
getEmail
());
throw
new
EntityExistException
(
User
.
class
,
"email"
,
resources
.
getEmail
());
}
}
if
(
userRepository
.
findByPhone
(
resources
.
getPhone
())
!=
null
)
{
if
(
userRepository
.
findByPhone
(
resources
.
getPhone
())
!=
null
)
{
throw
new
EntityExistException
(
User
.
class
,
"phone"
,
resources
.
getPhone
());
throw
new
EntityExistException
(
User
.
class
,
"phone"
,
resources
.
getPhone
());
}
}
userRepository
.
save
(
resources
);
userRepository
.
save
(
resources
);
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
User
resources
)
throws
Exception
{
public
void
update
(
User
resources
)
throws
Exception
{
User
user
=
userRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
User:
:
new
);
User
user
=
userRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
User:
:
new
);
ValidationUtil
.
isNull
(
user
.
getId
(),
"User"
,
"id"
,
resources
.
getId
());
ValidationUtil
.
isNull
(
user
.
getId
(),
"User"
,
"id"
,
resources
.
getId
());
User
user1
=
userRepository
.
findByUsername
(
resources
.
getUsername
());
User
user1
=
userRepository
.
findByUsername
(
resources
.
getUsername
());
User
user2
=
userRepository
.
findByEmail
(
resources
.
getEmail
());
User
user2
=
userRepository
.
findByEmail
(
resources
.
getEmail
());
User
user3
=
userRepository
.
findByPhone
(
resources
.
getPhone
());
User
user3
=
userRepository
.
findByPhone
(
resources
.
getPhone
());
if
(
user1
!=
null
&&
!
user
.
getId
().
equals
(
user1
.
getId
()))
{
if
(
user1
!=
null
&&
!
user
.
getId
().
equals
(
user1
.
getId
()))
{
throw
new
EntityExistException
(
User
.
class
,
"username"
,
resources
.
getUsername
());
throw
new
EntityExistException
(
User
.
class
,
"username"
,
resources
.
getUsername
());
}
}
if
(
user2
!=
null
&&
!
user
.
getId
().
equals
(
user2
.
getId
()))
{
if
(
user2
!=
null
&&
!
user
.
getId
().
equals
(
user2
.
getId
()))
{
throw
new
EntityExistException
(
User
.
class
,
"email"
,
resources
.
getEmail
());
throw
new
EntityExistException
(
User
.
class
,
"email"
,
resources
.
getEmail
());
}
}
if
(
user3
!=
null
&&
!
user
.
getId
().
equals
(
user3
.
getId
()))
{
if
(
user3
!=
null
&&
!
user
.
getId
().
equals
(
user3
.
getId
()))
{
throw
new
EntityExistException
(
User
.
class
,
"phone"
,
resources
.
getPhone
());
throw
new
EntityExistException
(
User
.
class
,
"phone"
,
resources
.
getPhone
());
}
}
// 如果用户的角色改变
// 如果用户的角色改变
if
(!
resources
.
getRoles
().
equals
(
user
.
getRoles
()))
{
if
(!
resources
.
getRoles
().
equals
(
user
.
getRoles
()))
{
redisUtils
.
del
(
CacheKey
.
DATA_USER
+
resources
.
getId
());
redisUtils
.
del
(
CacheKey
.
DATA_USER
+
resources
.
getId
());
redisUtils
.
del
(
CacheKey
.
MENU_USER
+
resources
.
getId
());
redisUtils
.
del
(
CacheKey
.
MENU_USER
+
resources
.
getId
());
redisUtils
.
del
(
CacheKey
.
ROLE_AUTH
+
resources
.
getId
());
redisUtils
.
del
(
CacheKey
.
ROLE_AUTH
+
resources
.
getId
());
}
}
// 如果用户被禁用,则清除用户登录信息
// 如果用户被禁用,则清除用户登录信息
if
(!
resources
.
getEnabled
())
{
if
(!
resources
.
getEnabled
())
{
onlineUserService
.
kickOutForUsername
(
resources
.
getUsername
());
onlineUserService
.
kickOutForUsername
(
resources
.
getUsername
());
}
}
user
.
setUsername
(
resources
.
getUsername
());
user
.
setUsername
(
resources
.
getUsername
());
user
.
setEmail
(
resources
.
getEmail
());
user
.
setEmail
(
resources
.
getEmail
());
user
.
setEnabled
(
resources
.
getEnabled
());
user
.
setEnabled
(
resources
.
getEnabled
());
user
.
setRoles
(
resources
.
getRoles
());
user
.
setRoles
(
resources
.
getRoles
());
user
.
setDept
(
resources
.
getDept
());
user
.
setDept
(
resources
.
getDept
());
user
.
setJobs
(
resources
.
getJobs
());
user
.
setJobs
(
resources
.
getJobs
());
user
.
setPhone
(
resources
.
getPhone
());
user
.
setPhone
(
resources
.
getPhone
());
user
.
setNickName
(
resources
.
getNickName
());
user
.
setNickName
(
resources
.
getNickName
());
user
.
setGender
(
resources
.
getGender
());
user
.
setGender
(
resources
.
getGender
());
userRepository
.
save
(
user
);
userRepository
.
save
(
user
);
// 清除缓存
// 清除缓存
delCaches
(
user
.
getId
(),
user
.
getUsername
());
delCaches
(
user
.
getId
(),
user
.
getUsername
());
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateCenter
(
User
resources
)
{
public
void
updateCenter
(
User
resources
)
{
User
user
=
userRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
User:
:
new
);
User
user
=
userRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
User:
:
new
);
User
user1
=
userRepository
.
findByPhone
(
resources
.
getPhone
());
User
user1
=
userRepository
.
findByPhone
(
resources
.
getPhone
());
if
(
user1
!=
null
&&
!
user
.
getId
().
equals
(
user1
.
getId
()))
{
if
(
user1
!=
null
&&
!
user
.
getId
().
equals
(
user1
.
getId
()))
{
throw
new
EntityExistException
(
User
.
class
,
"phone"
,
resources
.
getPhone
());
throw
new
EntityExistException
(
User
.
class
,
"phone"
,
resources
.
getPhone
());
}
}
user
.
setNickName
(
resources
.
getNickName
());
user
.
setNickName
(
resources
.
getNickName
());
user
.
setPhone
(
resources
.
getPhone
());
user
.
setPhone
(
resources
.
getPhone
());
user
.
setGender
(
resources
.
getGender
());
user
.
setGender
(
resources
.
getGender
());
userRepository
.
save
(
user
);
userRepository
.
save
(
user
);
// 清理缓存
// 清理缓存
delCaches
(
user
.
getId
(),
user
.
getUsername
());
delCaches
(
user
.
getId
(),
user
.
getUsername
());
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Set
<
Long
>
ids
)
{
public
void
delete
(
Set
<
Long
>
ids
)
{
for
(
Long
id
:
ids
)
{
for
(
Long
id
:
ids
)
{
// 清理缓存
// 清理缓存
UserDto
user
=
findById
(
id
);
UserDto
user
=
findById
(
id
);
delCaches
(
user
.
getId
(),
user
.
getUsername
());
delCaches
(
user
.
getId
(),
user
.
getUsername
());
}
}
userRepository
.
deleteAllByIdIn
(
ids
);
userRepository
.
deleteAllByIdIn
(
ids
);
}
}
@Override
@Override
public
UserDto
findByName
(
String
userName
)
{
public
UserDto
findByName
(
String
userName
)
{
User
user
=
userRepository
.
findByUsername
(
userName
);
User
user
=
userRepository
.
findByUsername
(
userName
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
throw
new
EntityNotFoundException
(
User
.
class
,
"name"
,
userName
);
throw
new
EntityNotFoundException
(
User
.
class
,
"name"
,
userName
);
}
else
{
}
else
{
return
userMapper
.
toDto
(
user
);
return
userMapper
.
toDto
(
user
);
}
}
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updatePass
(
String
username
,
String
pass
)
{
public
void
updatePass
(
String
username
,
String
pass
)
{
userRepository
.
updatePass
(
username
,
pass
,
new
Date
());
userRepository
.
updatePass
(
username
,
pass
,
new
Date
());
flushCache
(
username
);
flushCache
(
username
);
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Map
<
String
,
String
>
updateAvatar
(
MultipartFile
multipartFile
)
{
public
Map
<
String
,
String
>
updateAvatar
(
MultipartFile
multipartFile
)
{
User
user
=
userRepository
.
findByUsername
(
SecurityUtils
.
getCurrentUsername
());
User
user
=
userRepository
.
findByUsername
(
SecurityUtils
.
getCurrentUsername
());
String
oldPath
=
user
.
getAvatarPath
();
String
oldPath
=
user
.
getAvatarPath
();
String
imaUrl
=
UploadUtils
.
saveImg
(
multipartFile
,
SystemName
.
SYS
);
String
imaUrl
=
UploadUtils
.
saveImg
(
multipartFile
,
SystemName
.
SYS
);
user
.
setAvatarPath
(
imaUrl
);
user
.
setAvatarPath
(
imaUrl
);
user
.
setAvatarName
(
imaUrl
);
user
.
setAvatarName
(
imaUrl
);
userRepository
.
save
(
user
);
userRepository
.
save
(
user
);
if
(
StringUtils
.
isNotBlank
(
oldPath
))
{
if
(
StringUtils
.
isNotBlank
(
oldPath
))
{
FileUtil
.
del
(
oldPath
);
FileUtil
.
del
(
oldPath
);
}
}
@NotBlank
String
username
=
user
.
getUsername
();
@NotBlank
String
username
=
user
.
getUsername
();
flushCache
(
username
);
flushCache
(
username
);
return
new
HashMap
<
String
,
String
>(
1
)
{{
return
new
HashMap
<
String
,
String
>(
1
)
{{
put
(
"avatar"
,
imaUrl
);
put
(
"avatar"
,
imaUrl
);
}};
}};
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateEmail
(
String
username
,
String
email
)
{
public
void
updateEmail
(
String
username
,
String
email
)
{
userRepository
.
updateEmail
(
username
,
email
);
userRepository
.
updateEmail
(
username
,
email
);
flushCache
(
username
);
flushCache
(
username
);
}
}
@Override
@Override
public
void
download
(
List
<
UserDto
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
{
public
void
download
(
List
<
UserDto
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
for
(
UserDto
userDTO
:
queryAll
)
{
for
(
UserDto
userDTO
:
queryAll
)
{
List
<
String
>
roles
=
userDTO
.
getRoles
().
stream
().
map
(
RoleSmallDto:
:
getName
).
collect
(
Collectors
.
toList
());
List
<
String
>
roles
=
userDTO
.
getRoles
().
stream
().
map
(
RoleSmallDto:
:
getName
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"用户名"
,
userDTO
.
getUsername
());
map
.
put
(
"用户名"
,
userDTO
.
getUsername
());
map
.
put
(
"角色"
,
roles
);
map
.
put
(
"角色"
,
roles
);
map
.
put
(
"部门"
,
userDTO
.
getDept
().
getName
());
map
.
put
(
"部门"
,
userDTO
.
getDept
().
getName
());
map
.
put
(
"岗位"
,
userDTO
.
getJobs
().
stream
().
map
(
JobSmallDto:
:
getName
).
collect
(
Collectors
.
toList
()));
map
.
put
(
"岗位"
,
userDTO
.
getJobs
().
stream
().
map
(
JobSmallDto:
:
getName
).
collect
(
Collectors
.
toList
()));
map
.
put
(
"邮箱"
,
userDTO
.
getEmail
());
map
.
put
(
"邮箱"
,
userDTO
.
getEmail
());
map
.
put
(
"状态"
,
userDTO
.
getEnabled
()
?
"启用"
:
"禁用"
);
map
.
put
(
"状态"
,
userDTO
.
getEnabled
()
?
"启用"
:
"禁用"
);
map
.
put
(
"手机号码"
,
userDTO
.
getPhone
());
map
.
put
(
"手机号码"
,
userDTO
.
getPhone
());
map
.
put
(
"修改密码的时间"
,
userDTO
.
getPwdResetTime
());
map
.
put
(
"修改密码的时间"
,
userDTO
.
getPwdResetTime
());
map
.
put
(
"创建日期"
,
userDTO
.
getCreateTime
());
map
.
put
(
"创建日期"
,
userDTO
.
getCreateTime
());
list
.
add
(
map
);
list
.
add
(
map
);
}
}
FileUtil
.
downloadExcel
(
list
,
response
);
FileUtil
.
downloadExcel
(
list
,
response
);
}
}
/**
/**
* 清理缓存
* 清理缓存
*
*
* @param id /
* @param id /
*/
*/
public
void
delCaches
(
Long
id
,
String
username
)
{
public
void
delCaches
(
Long
id
,
String
username
)
{
redisUtils
.
del
(
CacheKey
.
USER_ID
+
id
);
redisUtils
.
del
(
CacheKey
.
USER_ID
+
id
);
flushCache
(
username
);
flushCache
(
username
);
}
}
/**
/**
* 清理 登陆时 用户缓存信息
* 清理 登陆时 用户缓存信息
*
*
* @param username /
* @param username /
*/
*/
private
void
flushCache
(
String
username
)
{
private
void
flushCache
(
String
username
)
{
userCacheClean
.
cleanUserCache
(
username
);
userCacheClean
.
cleanUserCache
(
username
);
}
}
@Override
@Override
public
void
sendCode
(
String
phone
)
{
public
void
sendCode
(
String
phone
)
{
User
user
=
userRepository
.
findByUsername
(
phone
);
User
user
=
userRepository
.
findByUsername
(
phone
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
Pfuser
pfuser
=
pfuserDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
Pfuser
.
builder
().
phone
(
phone
).
build
()));
Pfuser
pfuser
=
pfuserDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
Pfuser
.
builder
().
phone
(
phone
).
build
()));
AssertUtils
.
notNull
(
pfuser
,
"手机号不存在"
);
AssertUtils
.
notNull
(
pfuser
,
"手机号不存在"
);
}
}
String
code
=
RandomUtil
.
randomNumbers
(
6
);
String
code
=
RandomUtil
.
randomNumbers
(
6
);
String
content
=
"您的验证码为:"
+
code
+
"(5分钟内有效)。为了保障信息安全,如非本人操作请忽略本短信。"
;
String
content
=
"您的验证码为:"
+
code
+
"(5分钟内有效)。为了保障信息安全,如非本人操作请忽略本短信。"
;
boolean
sendMsg
=
MobileSmsUtils
.
sendMsg
(
phone
,
content
);
boolean
sendMsg
=
MobileSmsUtils
.
sendMsg
(
phone
,
content
);
log
.
info
(
">> phone: {}, sendCode: {}, success: {}"
,
phone
,
code
,
sendMsg
);
log
.
info
(
">> phone: {}, sendCode: {}, success: {}"
,
phone
,
code
,
sendMsg
);
redisUtils
.
setStr
(
CacheKeys
.
authCodeKey
(
phone
),
code
,
5
);
redisUtils
.
setStr
(
CacheKeys
.
authCodeKey
(
phone
),
code
,
5
);
}
}
@Override
@Override
public
void
resetPassword
(
LoginVo
vo
)
{
public
void
resetPassword
(
LoginVo
vo
)
{
verificationCode
(
vo
.
getPhone
(),
vo
.
getVerifyCode
());
verificationCode
(
vo
.
getPhone
(),
vo
.
getVerifyCode
());
User
user
=
userRepository
.
findByUsername
(
vo
.
getPhone
());
User
user
=
userRepository
.
findByUsername
(
vo
.
getPhone
());
if
(
user
==
null
)
{
if
(
user
==
null
)
{
user
=
addUser
(
vo
.
getPhone
());
user
=
addUser
(
vo
.
getPhone
());
}
}
AssertUtils
.
notNull
(
user
,
"手机号不存在"
);
AssertUtils
.
notNull
(
user
,
"手机号不存在"
);
updatePass
(
user
.
getUsername
(),
passwordEncoder
.
encode
(
vo
.
getPasswd
()));
updatePass
(
user
.
getUsername
(),
passwordEncoder
.
encode
(
vo
.
getPasswd
()));
}
}
/**
/**
* 保存用户
* 保存用户
*
*
* @param phone
* @param phone
* @return
* @return
*/
*/
private
User
addUser
(
String
phone
)
{
private
User
addUser
(
String
phone
)
{
Pfuser
pfuser
=
pfuserDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
Pfuser
.
builder
().
phone
(
phone
).
build
()));
Pfuser
pfuser
=
pfuserDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
Pfuser
.
builder
().
phone
(
phone
).
build
()));
if
(
pfuser
==
null
)
{
if
(
pfuser
==
null
)
{
return
null
;
return
null
;
}
}
User
user
=
userRepository
.
findByUsername
(
phone
);
User
user
=
userRepository
.
findByUsername
(
phone
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
user
=
new
User
();
user
=
new
User
();
List
<
Role
>
roleList
=
roleRepository
.
findAllById
(
Collections
.
singletonList
(
2L
));
List
<
Role
>
roleList
=
roleRepository
.
findAllById
(
Collections
.
singletonList
(
2L
));
user
.
setRoles
(
new
HashSet
<>(
roleList
));
user
.
setRoles
(
new
HashSet
<>(
roleList
));
List
<
Job
>
jobList
=
jobRepository
.
findAllById
(
Collections
.
singletonList
(
13L
));
List
<
Job
>
jobList
=
jobRepository
.
findAllById
(
Collections
.
singletonList
(
13L
));
user
.
setJobs
(
new
HashSet
<>(
jobList
));
user
.
setJobs
(
new
HashSet
<>(
jobList
));
deptRepository
.
findById
(
8L
).
ifPresent
(
user:
:
setDept
);
deptRepository
.
findById
(
8L
).
ifPresent
(
user:
:
setDept
);
user
.
setUsername
(
phone
);
user
.
setUsername
(
phone
);
user
.
setNickName
(
pfuser
.
getUsername
());
user
.
setNickName
(
pfuser
.
getUsername
());
user
.
setGender
(
pfuser
.
getSex
()
==
null
?
"未知"
:
pfuser
.
getSex
()
==
0
?
"男"
:
"女"
);
user
.
setGender
(
pfuser
.
getSex
()
==
null
?
"未知"
:
pfuser
.
getSex
()
==
0
?
"男"
:
"女"
);
user
.
setPhone
(
phone
);
user
.
setPhone
(
phone
);
user
.
setEmail
(
pfuser
.
getSourcemail
());
user
.
setEmail
(
pfuser
.
getSourcemail
());
user
.
setPassword
(
passwordEncoder
.
encode
(
"gxmz!23"
));
user
.
setPassword
(
passwordEncoder
.
encode
(
"gxmz!23"
));
user
.
setIsAdmin
(
false
);
user
.
setIsAdmin
(
false
);
user
.
setEnabled
(
true
);
user
.
setEnabled
(
true
);
user
.
setCreateBy
(
"admin"
);
user
.
setCreateBy
(
"admin"
);
user
.
setUpdatedBy
(
"admin"
);
user
.
setUpdatedBy
(
"admin"
);
user
.
setCreateTime
(
DateUtil
.
date
().
toTimestamp
());
user
.
setCreateTime
(
DateUtil
.
date
().
toTimestamp
());
user
.
setUpdateTime
(
DateUtil
.
date
().
toTimestamp
());
user
.
setUpdateTime
(
DateUtil
.
date
().
toTimestamp
());
create
(
user
);
create
(
user
);
}
}
return
user
;
return
user
;
}
}
/**
/**
* 判断验证码
* 判断验证码
*
*
* @param phone
* @param phone
* @param code
* @param code
*/
*/
public
void
verificationCode
(
String
phone
,
String
code
)
{
public
void
verificationCode
(
String
phone
,
String
code
)
{
String
cacheCode
=
redisUtils
.
getStr
(
CacheKeys
.
authCodeKey
(
phone
));
String
cacheCode
=
redisUtils
.
getStr
(
CacheKeys
.
authCodeKey
(
phone
));
AssertUtils
.
isTrue
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
cacheCode
)
&&
cacheCode
.
equalsIgnoreCase
(
code
),
"验证码错误"
);
AssertUtils
.
isTrue
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
cacheCode
)
&&
cacheCode
.
equalsIgnoreCase
(
code
),
"验证码错误"
);
redisUtils
.
deleteStr
(
CacheKeys
.
authCodeKey
(
phone
));
redisUtils
.
deleteStr
(
CacheKeys
.
authCodeKey
(
phone
));
}
}
@Override
@Override
public
void
modifyPasswd
(
LoginVo
vo
)
{
public
void
modifyPasswd
(
LoginVo
vo
)
{
verificationCode
(
vo
.
getPhone
(),
vo
.
getVerifyCode
());
verificationCode
(
vo
.
getPhone
(),
vo
.
getVerifyCode
());
User
user
=
userRepository
.
findByUsername
(
vo
.
getPhone
());
User
user
=
userRepository
.
findByUsername
(
vo
.
getPhone
());
AssertUtils
.
notNull
(
user
,
"手机号不存在"
);
AssertUtils
.
notNull
(
user
,
"手机号不存在"
);
updatePass
(
user
.
getUsername
(),
passwordEncoder
.
encode
(
vo
.
getPasswd
()));
updatePass
(
user
.
getUsername
(),
passwordEncoder
.
encode
(
vo
.
getPasswd
()));
}
}
@Override
@Override
public
ApiTokenVo
phoneLogin
(
LoginVo
vo
)
{
public
ApiTokenVo
phoneLogin
(
LoginVo
vo
)
{
User
user
=
userRepository
.
findByUsername
(
vo
.
getPhone
());
User
user
=
userRepository
.
findByUsername
(
vo
.
getPhone
());
if
(
user
==
null
)
{
if
(
user
==
null
)
{
user
=
addUser
(
vo
.
getPhone
());
user
=
addUser
(
vo
.
getPhone
());
}
}
AssertUtils
.
notNull
(
user
,
"手机号不存在"
);
AssertUtils
.
notNull
(
user
,
"手机号不存在"
);
verificationCode
(
vo
.
getPhone
(),
vo
.
getVerifyCode
());
verificationCode
(
vo
.
getPhone
(),
vo
.
getVerifyCode
());
AssertUtils
.
isTrue
(
user
.
getEnabled
(),
"账号已禁用"
);
AssertUtils
.
isTrue
(
user
.
getEnabled
(),
"账号已禁用"
);
return
getApiToken
(
user
);
return
getApiToken
(
user
);
}
}
/**
/**
* 获取ApiToken
* 获取ApiToken
*
*
* @param user
* @param user
* @return
* @return
*/
*/
private
ApiTokenVo
getApiToken
(
User
user
)
{
private
ApiTokenVo
getApiToken
(
User
user
)
{
ApiTokenVo
tokenVo
=
ApiTokenVo
.
builder
()
ApiTokenVo
tokenVo
=
ApiTokenVo
.
builder
()
.
userId
(
user
.
getId
())
.
userId
(
user
.
getId
())
.
phone
(
user
.
getPhone
())
.
phone
(
user
.
getPhone
())
.
username
(
user
.
getUsername
())
.
username
(
user
.
getUsername
())
.
name
(
user
.
getNickName
())
.
name
(
user
.
getNickName
())
.
nickname
(
user
.
getNickName
())
.
nickname
(
user
.
getNickName
())
.
sex
(
user
.
getGender
())
.
sex
(
user
.
getGender
())
.
avatar
(
user
.
getAvatarPath
())
.
avatar
(
user
.
getAvatarPath
())
.
build
();
.
build
();
String
token
=
ApiTokenUtils
.
createToken
(
tokenVo
,
CacheKeys
.
APP_TOKEN_EXPIRE_MINUTES
);
String
token
=
ApiTokenUtils
.
createToken
(
tokenVo
,
CacheKeys
.
APP_TOKEN_EXPIRE_MINUTES
);
tokenVo
.
setToken
(
token
);
tokenVo
.
setToken
(
token
);
// 重新登录删除前一个token实现单机登录
// 重新登录删除前一个token实现单机登录
String
cacheToken
=
redisUtils
.
getStr
(
CacheKeys
.
liveAppTokenKey
(
user
.
getId
().
toString
()));
String
cacheToken
=
redisUtils
.
getStr
(
CacheKeys
.
liveAppTokenKey
(
user
.
getId
().
toString
()));
redisUtils
.
deleteObj
(
CacheKeys
.
appTokenKey
(
cacheToken
));
redisUtils
.
deleteObj
(
CacheKeys
.
appTokenKey
(
cacheToken
));
redisUtils
.
deleteStr
(
CacheKeys
.
liveAppTokenKey
(
user
.
getId
().
toString
()));
redisUtils
.
deleteStr
(
CacheKeys
.
liveAppTokenKey
(
user
.
getId
().
toString
()));
// 缓存登录用户
// 缓存登录用户
redisUtils
.
setObj
(
CacheKeys
.
appTokenKey
(
token
),
tokenVo
,
CacheKeys
.
APP_TOKEN_EXPIRE_MINUTES
);
redisUtils
.
setObj
(
CacheKeys
.
appTokenKey
(
token
),
tokenVo
,
CacheKeys
.
APP_TOKEN_EXPIRE_MINUTES
);
// 用户ID作为key保存token, 再次登录可以找出该用户的token
// 用户ID作为key保存token, 再次登录可以找出该用户的token
redisUtils
.
setStr
(
CacheKeys
.
liveAppTokenKey
(
user
.
getId
().
toString
()),
token
,
CacheKeys
.
APP_TOKEN_EXPIRE_MINUTES
);
redisUtils
.
setStr
(
CacheKeys
.
liveAppTokenKey
(
user
.
getId
().
toString
()),
token
,
CacheKeys
.
APP_TOKEN_EXPIRE_MINUTES
);
return
tokenVo
;
return
tokenVo
;
}
}
@Override
@Override
public
ApiTokenVo
passwdLogin
(
LoginVo
vo
)
{
public
ApiTokenVo
passwdLogin
(
LoginVo
vo
)
{
User
user
=
userRepository
.
findByUsername
(
vo
.
getPhone
());
User
user
=
userRepository
.
findByUsername
(
vo
.
getPhone
());
AssertUtils
.
notNull
(
user
,
"手机号不存在"
);
AssertUtils
.
notNull
(
user
,
"手机号不存在"
);
AssertUtils
.
hasText
(
user
.
getPassword
(),
"未设置密码"
);
AssertUtils
.
hasText
(
user
.
getPassword
(),
"未设置密码"
);
AssertUtils
.
isTrue
(
passwordEncoder
.
matches
(
vo
.
getPasswd
(),
user
.
getPassword
()),
"密码错误"
);
AssertUtils
.
isTrue
(
passwordEncoder
.
matches
(
vo
.
getPasswd
(),
user
.
getPassword
()),
"密码错误"
);
AssertUtils
.
isTrue
(
user
.
getEnabled
(),
"账号已禁用"
);
AssertUtils
.
isTrue
(
user
.
getEnabled
(),
"账号已禁用"
);
return
getApiToken
(
user
);
return
getApiToken
(
user
);
}
}
}
@Override
public
void
resetPassword2
(
LoginVo
vo
)
{
verificationCode
(
vo
.
getPhone
(),
vo
.
getVerifyCode
());
User
user
=
userRepository
.
findBySysname
(
vo
.
getPhone
());
AssertUtils
.
notNull
(
user
,
"手机号不存在"
);
updatePass
(
user
.
getUsername
(),
passwordEncoder
.
encode
(
vo
.
getPasswd
()));
}
}
sys-server/src/main/resources/mapper/CremationInfoSumMapper.xml
View file @
8f1741c5
...
@@ -12,6 +12,6 @@
...
@@ -12,6 +12,6 @@
</resultMap>
</resultMap>
<select
id=
"selectByNameOrIdcard"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByNameOrIdcard"
resultMap=
"BaseResultMap"
>
select * from GX_BZ.FIS_CREMATION_INFO_SUM t
select * from GX_BZ.FIS_CREMATION_INFO_SUM t
where t.ID_CARD=#{idCard}
and
t.NAME=#{name}
where t.ID_CARD=#{idCard}
OR
t.NAME=#{name}
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
sys-server/src/main/resources/mapper/EnbuzMemberStopMapper.xml
View file @
8f1741c5
...
@@ -14,4 +14,4 @@
...
@@ -14,4 +14,4 @@
select t.MEMBER_NAME as name,t.IDENTIFCARD_ID as idCard,t.* from GX_BZ.ENBUZ_MEMBER_STOP t
select t.MEMBER_NAME as name,t.IDENTIFCARD_ID as idCard,t.* from GX_BZ.ENBUZ_MEMBER_STOP t
where t.IDENTIFCARD_ID=#{idCard} and t.MEMBER_NAME=#{name}
where t.IDENTIFCARD_ID=#{idCard} and t.MEMBER_NAME=#{name}
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
sys-server/src/main/resources/mapper/HdptRstSwmdMapper.xml
View file @
8f1741c5
...
@@ -15,6 +15,6 @@
...
@@ -15,6 +15,6 @@
FROM
FROM
GX_BZ.HDPT_RST_SWMD
GX_BZ.HDPT_RST_SWMD
WHERE
WHERE
ID = ( SELECT MAX( ID ) FROM GX_BZ.HDPT_RST_SWMD t WHERE t.ID_CARD = #{idCard}
AND
t.NAME = #{name} )
ID = ( SELECT MAX( ID ) FROM GX_BZ.HDPT_RST_SWMD t WHERE t.ID_CARD = #{idCard}
OR
t.NAME = #{name} )
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
sys-server/src/main/resources/mapper/ReportDeathMapper.xml
View file @
8f1741c5
...
@@ -17,28 +17,90 @@
...
@@ -17,28 +17,90 @@
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
</resultMap>
<insert
id=
"insertInTo"
>
INSERT INTO GX_BZ.REPORT_DEATHS (NAME, ID_CARD, DEATH_REASON,DEATH_PLACE,DEATH_DATE, SOURCE,USER_AREA, USER_NAME, DEATH_TYPE, update_time)
VALUES (#{name,jdbcType=VARCHAR}, #{idCard,jdbcType=VARCHAR},#{deathReason,jdbcType=VARCHAR}, #{deathPlace,jdbcType=VARCHAR},#{deathDate,jdbcType=VARCHAR},#{source,jdbcType=VARCHAR},#{userArea,jdbcType=VARCHAR},#{userName,jdbcType=VARCHAR},#{deathType,jdbcType=VARCHAR},#{updateTime,jdbcType=TIMESTAMP})
</insert>
<update
id=
"updateDeath"
>
UPDATE GX_BZ.REPORT_DEATHS SET DEATH_TYPE=#{deathType} WHERE ID_CARD=#{idCard}
</update>
<select
id=
"selectByIdCard"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByIdCard"
resultMap=
"BaseResultMap"
>
select * from GX_BZ.REPORT_DEATHS t where t.ID_CARD=#{idCard}
select *
from GX_BZ.REPORT_DEATHS t
where t.ID_CARD = #{idCard}
</select>
</select>
<!-- <update id="updateByappId">-->
<!-- UPDATE report_death-->
<select
id=
"selectAllDeaths"
resultType=
"com.zq.system.modules.system.domain.vo.ReportDeathVo"
>
<!-- <set>-->
SELECT
<!-- <if test="appId != null">-->
*
<!-- app_id = #{appId, jdbcType=OTHER},-->
FROM
<!-- </if>-->
( SELECT t.*, ROWNUM r FROM GX_BZ.REPORT_DEATH t WHERE UPDATE_TIME IS NOT NULL) h
<!-- <if test="systemName != null">-->
WHERE
<!-- system_name = #{systemName, jdbcType=OTHER},-->
r BETWEEN ( ( #{page} - 1 ) * #{size} + 1 )
<!-- </if>-->
AND ( #{page} * #{size} )
<!-- <if test="systemTag != null">-->
<!-- <if test="idCard != null">-->
<!-- system_tag = #{systemTag, jdbcType=OTHER},-->
<!-- AND h.ID_CARD = #{idCard, jdbcType=VARCHAR}-->
<!-- </if>-->
<!-- </if>-->
<!-- <if test="createTime != null">-->
<!-- <if test="name != null">-->
<!-- create_time = #{createTime, jdbcType=TIMESTAMP},-->
<!-- AND h.NAME = #{name, jdbcType=VARCHAR}-->
<!-- </if>-->
<!-- </if>-->
<!-- <if test="updateTime != null">-->
ORDER BY UPDATE_TIME DESC
<!-- update_time = #{updateTime, jdbcType=TIMESTAMP},-->
</select>
<!-- </if>-->
<select
id=
"selectAllCount"
resultType=
"java.lang.Integer"
>
<!-- </set>-->
select count(1) from GX_BZ.REPORT_DEATH t
<!-- WHERE app_id = #{appId}-->
<where>
<!-- </update>-->
<if
test=
"idCard != null"
>
</mapper>
AND t.ID_CARD = #{idCard, jdbcType=OTHER}
\ No newline at end of file
</if>
<if
test=
"name != null"
>
AND t.NAME = #{name, jdbcType=OTHER}
</if>
<if
test=
"deathType != null"
>
AND t.DEATH_TYPE = #{deathType, jdbcType=OTHER}
</if>
</where>
</select>
<select
id=
"selectByNameOrIdcard"
resultType=
"com.zq.system.modules.system.entity.ReportDeath"
>
SELECT *
FROM GX_BZ.REPORT_DEATHS t
WHERE t.ID_CARD = #{idCard}
OR t.NAME LIKE CONCAT('#{name}','%' )
</select>
<select
id=
"getDeathByName"
resultType=
"com.zq.system.modules.system.domain.vo.ReportDeathVo"
>
select * from GX_BZ.REPORT_DEATH t
<where>
<if
test=
"idCard != null"
>
AND t.ID_CARD = #{idCard}
</if>
<if
test=
"name != null"
>
AND t.NAME LIKE CONCAT('${name}','%' )
</if>
<if
test=
"deathType"
>
AND t.DEATH_TYPE = #{deathType}
</if>
</where>
</select>
<!-- <update id="updateByappId">-->
<!-- UPDATE report_death-->
<!-- <set>-->
<!-- <if test="appId != null">-->
<!-- app_id = #{appId, jdbcType=OTHER},-->
<!-- </if>-->
<!-- <if test="systemName != null">-->
<!-- system_name = #{systemName, jdbcType=OTHER},-->
<!-- </if>-->
<!-- <if test="systemTag != null">-->
<!-- system_tag = #{systemTag, jdbcType=OTHER},-->
<!-- </if>-->
<!-- <if test="createTime != null">-->
<!-- create_time = #{createTime, jdbcType=TIMESTAMP},-->
<!-- </if>-->
<!-- <if test="updateTime != null">-->
<!-- update_time = #{updateTime, jdbcType=TIMESTAMP},-->
<!-- </if>-->
<!-- </set>-->
<!-- WHERE app_id = #{appId}-->
<!-- </update>-->
</mapper>
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