Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
16363d0f
Commit
16363d0f
authored
Jan 12, 2023
by
王亮
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-disable-user-20230105' into 'master'
Feature disable user 20230105 See merge request
!103
parents
bc21a908
e234dd6c
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1826 additions
and
1495 deletions
+1826
-1495
Bootstrap.java
src/main/java/cn/quantgroup/xyqb/Bootstrap.java
+2
-0
HttpConfig.java
src/main/java/cn/quantgroup/xyqb/config/http/HttpConfig.java
+5
-6
MyWebMvcConfigurer.java
...va/cn/quantgroup/xyqb/config/http/MyWebMvcConfigurer.java
+26
-20
InnerController.java
...tgroup/xyqb/controller/internal/user/InnerController.java
+1629
-1469
UserController.java
...oup/xyqb/controller/middleoffice/user/UserController.java
+2
-0
UserDisableRecord.java
...ain/java/cn/quantgroup/xyqb/entity/UserDisableRecord.java
+28
-0
UserDisableRecordEvent.java
...java/cn/quantgroup/xyqb/event/UserDisableRecordEvent.java
+21
-0
UserDisableRecordListener.java
...a/cn/quantgroup/xyqb/event/UserDisableRecordListener.java
+18
-0
LoginUserContext.java
src/main/java/cn/quantgroup/xyqb/model/LoginUserContext.java
+11
-0
OauthResult.java
src/main/java/cn/quantgroup/xyqb/model/OauthResult.java
+18
-0
UserDisableRecordModel.java
...java/cn/quantgroup/xyqb/model/UserDisableRecordModel.java
+41
-0
StmsRemoteService.java
...ain/java/cn/quantgroup/xyqb/remote/StmsRemoteService.java
+12
-0
IUserDisableRecordRepository.java
...ntgroup/xyqb/repository/IUserDisableRecordRepository.java
+13
-0
No files found.
src/main/java/cn/quantgroup/xyqb/Bootstrap.java
View file @
16363d0f
...
...
@@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cloud.netflix.feign.EnableFeignClients
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.scheduling.annotation.EnableAsync
;
...
...
@@ -24,6 +25,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@EnableAspectJAutoProxy
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
})
@EnableConfigurationProperties
({
SequencerProperties
.
class
})
@EnableFeignClients
public
class
Bootstrap
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/cn/quantgroup/xyqb/config/http/HttpConfig.java
View file @
16363d0f
...
...
@@ -80,7 +80,6 @@ public class HttpConfig {
DeserializationFeature
.
ACCEPT_EMPTY_STRING_AS_NULL_OBJECT
);
return
builder
;
}
@Bean
public
ConverterRegistry
defaultConversionService
()
{
FormattingConversionService
conversionService
=
new
DefaultFormattingConversionService
();
...
...
src/main/java/cn/quantgroup/xyqb/config/http/MyWebMvcConfigurer.java
View file @
16363d0f
...
...
@@ -21,6 +21,7 @@ public class MyWebMvcConfigurer extends WebMvcConfigurerAdapter {
/**
* 快速校验参数. 第一个出错后面的不用再校验了
*
* @return
*/
@Bean
...
...
@@ -34,4 +35,9 @@ public class MyWebMvcConfigurer extends WebMvcConfigurerAdapter {
postProcessor
.
setValidator
(
validator
);
return
postProcessor
;
}
// @Override
// public void addInterceptors(InterceptorRegistry registry) {
// registry.addInterceptor(new TokenInterceptor()).addPathPatterns("/innerapi/user/**");
// }
}
\ No newline at end of file
src/main/java/cn/quantgroup/xyqb/controller/internal/user/InnerController.java
View file @
16363d0f
package
cn
.
quantgroup
.
xyqb
.
controller
.
internal
.
user
;
import
cn.quantgroup.user.enums.*
;
import
static
cn
.
quantgroup
.
xyqb
.
constant
.
UserConstant
.
USER_ERROR_OR_ENABLE_ERROR
;
import
cn.quantgroup.user.enums.BizType
;
import
cn.quantgroup.user.enums.EducationEnum
;
import
cn.quantgroup.user.enums.IncomeEnum
;
import
cn.quantgroup.user.enums.IncomeRangeEnum
;
import
cn.quantgroup.user.enums.MaritalStatus
;
import
cn.quantgroup.user.enums.OccupationEnum
;
import
cn.quantgroup.user.enums.Relation
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.aspect.accessable.IpValidator
;
import
cn.quantgroup.xyqb.aspect.forbidden.AccessForbiddenValidator
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.entity.Address
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserBtRegister
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDisableRecord
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.entity.UserSpouse
;
import
cn.quantgroup.xyqb.entity.WechatUserInfo
;
import
cn.quantgroup.xyqb.event.DisableActiveEvent
;
import
cn.quantgroup.xyqb.event.UserDisableRecordEvent
;
import
cn.quantgroup.xyqb.event.UserExtInfoSaveEvent
;
import
cn.quantgroup.xyqb.exception.UserNotExistException
;
import
cn.quantgroup.xyqb.model.AddressRet
;
import
cn.quantgroup.xyqb.model.ContactInfo
;
import
cn.quantgroup.xyqb.model.ContactRet
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.*
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.LoginUserContext
;
import
cn.quantgroup.xyqb.model.OauthResult
;
import
cn.quantgroup.xyqb.model.Tuple
;
import
cn.quantgroup.xyqb.model.UserAssociation
;
import
cn.quantgroup.xyqb.model.UserAssociationModel
;
import
cn.quantgroup.xyqb.model.UserDetailRet
;
import
cn.quantgroup.xyqb.model.UserDisableRecordModel
;
import
cn.quantgroup.xyqb.model.UserExtInfoRet
;
import
cn.quantgroup.xyqb.model.UserFullInfo
;
import
cn.quantgroup.xyqb.model.UserInfo
;
import
cn.quantgroup.xyqb.model.UserRet
;
import
cn.quantgroup.xyqb.model.UserSpouseRet
;
import
cn.quantgroup.xyqb.model.UserStatistics
;
import
cn.quantgroup.xyqb.remote.StmsRemoteService
;
import
cn.quantgroup.xyqb.repository.IUserDisableRecordRepository
;
import
cn.quantgroup.xyqb.service.api.IUserApiService
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.merchant.IMerchantService
;
...
...
@@ -20,10 +57,25 @@ import cn.quantgroup.xyqb.service.register.IUserDeregisterService;
import
cn.quantgroup.xyqb.service.register.IUserRegisterService
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.sms.ISmsService
;
import
cn.quantgroup.xyqb.service.user.*
;
import
cn.quantgroup.xyqb.service.user.CleanDataService
;
import
cn.quantgroup.xyqb.service.user.IAddressService
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
cn.quantgroup.xyqb.service.user.IOauthLoginInfoService
;
import
cn.quantgroup.xyqb.service.user.ITenantService
;
import
cn.quantgroup.xyqb.service.user.IUserBtRegisterService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserExtInfoService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.IUserSpouseService
;
import
cn.quantgroup.xyqb.service.user.vo.UserDetailVO
;
import
cn.quantgroup.xyqb.service.wechat.IWechatService
;
import
cn.quantgroup.xyqb.util.*
;
import
cn.quantgroup.xyqb.util.AesUtil
;
import
cn.quantgroup.xyqb.util.BctyptPasswordUtil
;
import
cn.quantgroup.xyqb.util.IpUtil
;
import
cn.quantgroup.xyqb.util.MqUtils
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
cn.quantgroup.xyqb.util.TenantUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.encrypt.Md5Util
;
import
cn.quantgroup.xyqb.validator.ChineseName
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -31,27 +83,40 @@ import com.alibaba.fastjson.JSONObject;
import
com.alibaba.fastjson.TypeReference
;
import
com.google.common.base.MoreObjects
;
import
com.google.common.collect.Maps
;
import
java.io.UnsupportedEncodingException
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.apache.http.HttpStatus
;
import
org.hibernate.validator.constraints.Length
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.io.UnsupportedEncodingException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
cn
.
quantgroup
.
xyqb
.
constant
.
UserConstant
.
USER_ERROR_OR_ENABLE_ERROR
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
...
...
@@ -96,7 +161,8 @@ public class InnerController implements IBaseController {
@Resource
private
CleanDataService
cleanDataService
;
@Autowired
private
StmsRemoteService
stmsRemoteService
;
@Autowired
private
ITenantService
tenantService
;
...
...
@@ -106,7 +172,8 @@ public class InnerController implements IBaseController {
@Autowired
private
IUserDeregisterService
userDeregisterService
;
@Autowired
private
IUserDisableRecordRepository
iUserDisableRecordRepository
;
private
static
final
String
RESET_PWD_TOKEN
=
"ecf75c1f-2ccb-4661-8e4b-2874c0f45a2b"
;
private
static
final
String
MODIFY_CONTACT_TOKEN
=
"@qwsdedad131323213w!"
;
...
...
@@ -144,7 +211,7 @@ public class InnerController implements IBaseController {
if
(
tenantId
!=
null
&&
!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
// userId 查询对应productLogin 获取手机号和customerId
user
=
tenantService
.
getTenantUser
(
user
,
tenantId
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
}
}
...
...
@@ -165,7 +232,7 @@ public class InnerController implements IBaseController {
if
(
tenantId
!=
null
&&
!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
// userId 查询对应productLogin 获取手机号和customerId
user
=
tenantService
.
getTenantUser
(
user
,
tenantId
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
}
}
...
...
@@ -218,7 +285,7 @@ public class InnerController implements IBaseController {
if
(
tenantId
!=
null
&&
!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
// userId 查询对应productLogin 获取手机号和customerId
user
=
tenantService
.
getTenantUser
(
user
,
tenantId
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
""
,
null
);
}
}
...
...
@@ -275,7 +342,8 @@ public class InnerController implements IBaseController {
* @yapi http://yapi.quantgroups.com/project/17/interface/api/205
*/
@RequestMapping
(
"/user/getPhoneByUserIds"
)
public
JsonResult
findByIds
(
@RequestParam
(
value
=
"userIds"
)
String
userIdsString
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
public
JsonResult
findByIds
(
@RequestParam
(
value
=
"userIds"
)
String
userIdsString
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
log
.
info
(
"批量查询用户的手机号列表, userIdsString:"
+
userIdsString
+
", tenantId:"
+
tenantId
);
//默认羊小咩租户
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
...
...
@@ -333,17 +401,20 @@ public class InnerController implements IBaseController {
}
/**
* 保存用户详细信息
* 适用于:创建 或 修改
* 保存用户详细信息 适用于:创建 或 修改
*
* @yapi http://yapi.quantgroups.com/project/17/interface/api/285
*/
@RequestMapping
(
"/user_detail/save"
)
public
JsonResult
saveUserDetail
(
@Min
(
value
=
1
,
message
=
"用户id为空"
)
@RequestParam
Long
userId
,
public
JsonResult
saveUserDetail
(
@Min
(
value
=
1
,
message
=
"用户id为空"
)
@RequestParam
Long
userId
,
String
phoneNo
,
@ChineseName
@RequestParam
String
name
,
String
idNo
,
String
email
,
String
qq
)
{
log
.
info
(
"保存用户详细信息,[saveUserDetail] userId:{},phoneNo:{},name:{},idNo:{},email:{},qq:{}"
,
userId
,
phoneNo
,
name
,
idNo
,
email
,
qq
);
log
.
info
(
"保存用户详细信息,[saveUserDetail] userId:{},phoneNo:{},name:{},idNo:{},email:{},qq:{}"
,
userId
,
phoneNo
,
name
,
idNo
,
email
,
qq
);
//参数验证
if
(
Objects
.
isNull
(
userId
))
{
return
JsonResult
.
buildErrorStateResult
(
"userId为空."
,
null
);
...
...
@@ -397,7 +468,8 @@ public class InnerController implements IBaseController {
userDetail
.
setEmail
(
email
);
userDetail
.
setQq
(
qq
);
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
log
.
info
(
"InnerController saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
phoneNo
,
name
);
log
.
info
(
"InnerController saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
phoneNo
,
name
);
if
(
userDetail
!=
null
)
{
return
JsonResult
.
buildSuccessResult
(
null
,
UserDetailRet
.
getUserDetail
(
userDetail
));
}
...
...
@@ -406,6 +478,7 @@ public class InnerController implements IBaseController {
/**
* 根据用户id查询用户的详细信息
*
* @yapi http://yapi.quantgroups.com/project/17/interface/api/237
*/
@AccessForbiddenValidator
...
...
@@ -439,7 +512,7 @@ public class InnerController implements IBaseController {
if
(
tenantId
!=
null
&&
!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
// userId 查询对应productLogin 获取手机号和customerId
user
=
tenantService
.
getTenantUser
(
user
,
tenantId
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
}
}
...
...
@@ -554,13 +627,16 @@ public class InnerController implements IBaseController {
}
@RequestMapping
(
"/contact/save/contacts"
)
public
JsonResult
save2Contact
(
Long
userId
,
@RequestParam
(
value
=
"contacts"
)
String
contactsStr
)
{
public
JsonResult
save2Contact
(
Long
userId
,
@RequestParam
(
value
=
"contacts"
)
String
contactsStr
)
{
if
(
Objects
.
isNull
(
userId
)
||
StringUtils
.
isBlank
(
contactsStr
))
{
log
.
warn
(
"保存用户联系人:参数不完整:userId:{}, contacts:{}"
,
userId
,
contactsStr
);
return
JsonResult
.
buildErrorStateResult
(
"参数不完整"
,
String
.
valueOf
(
userId
).
concat
(
":"
).
concat
(
contactsStr
));
return
JsonResult
.
buildErrorStateResult
(
"参数不完整"
,
String
.
valueOf
(
userId
).
concat
(
":"
).
concat
(
contactsStr
));
}
log
.
info
(
"保存用户联系人:userId:{}, contacts:{}"
,
userId
,
contactsStr
);
List
<
Contact
>
contacts
=
JSONObject
.
parseObject
(
contactsStr
,
new
TypeReference
<
List
<
Contact
>>()
{
List
<
Contact
>
contacts
=
JSONObject
.
parseObject
(
contactsStr
,
new
TypeReference
<
List
<
Contact
>>()
{
});
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
log
.
info
(
"联系人不能为空"
);
...
...
@@ -568,7 +644,8 @@ public class InnerController implements IBaseController {
}
for
(
Contact
contact
:
contacts
)
{
if
(!
contact
.
valid
())
{
log
.
info
(
"用户手机号或姓名错误, phoneNo:{},name:{}"
,
contact
.
getPhoneNo
(),
contact
.
getName
());
log
.
info
(
"用户手机号或姓名错误, phoneNo:{},name:{}"
,
contact
.
getPhoneNo
(),
contact
.
getName
());
return
JsonResult
.
buildErrorStateResult
(
"用户手机号或姓名错误"
,
contact
);
}
}
...
...
@@ -577,7 +654,8 @@ public class InnerController implements IBaseController {
}
@RequestMapping
(
"/contact/update/contact"
)
public
JsonResult
updateContact
(
@RequestParam
Long
contactId
,
@RequestParam
(
required
=
false
)
String
name
,
public
JsonResult
updateContact
(
@RequestParam
Long
contactId
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
phoneNo
,
@RequestParam
(
required
=
false
)
Relation
relation
,
String
key
,
@RequestParam
String
reason
,
HttpServletRequest
request
)
{
...
...
@@ -603,7 +681,8 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"修改联系人不存在"
,
null
);
}
contact
=
contactService
.
saveContact
(
name
,
phoneNo
,
relation
,
contact
);
log
.
info
(
"修改后联系人信息:{},修改原因:{},操作ip:{}"
,
contact
,
reason
,
IpUtil
.
getRemoteIP
(
request
));
log
.
info
(
"修改后联系人信息:{},修改原因:{},操作ip:{}"
,
contact
,
reason
,
IpUtil
.
getRemoteIP
(
request
));
return
JsonResult
.
buildSuccessResult
(
"修改联系人成功"
,
contact
);
}
...
...
@@ -624,9 +703,13 @@ public class InnerController implements IBaseController {
public
JsonResult
saveAddress
(
Long
userId
,
Long
provinceCode
,
Long
cityCode
,
String
city
,
Long
districtCode
,
String
district
,
String
address
,
String
province
)
{
log
.
info
(
"保存地址详情:city:{},province:{},district:{}, address:{},userId:{}"
,
city
,
province
,
district
,
address
,
userId
);
if
(
userId
==
null
||
provinceCode
==
null
||
cityCode
==
null
||
StringUtils
.
isBlank
(
address
))
{
log
.
info
(
"错误保存地址详情,其中参数不能为空:city:{},province:{},district:{}, address:{},userId:{}"
,
city
,
province
,
district
,
address
,
userId
);
log
.
info
(
"保存地址详情:city:{},province:{},district:{}, address:{},userId:{}"
,
city
,
province
,
district
,
address
,
userId
);
if
(
userId
==
null
||
provinceCode
==
null
||
cityCode
==
null
||
StringUtils
.
isBlank
(
address
))
{
log
.
info
(
"错误保存地址详情,其中参数不能为空:city:{},province:{},district:{}, address:{},userId:{}"
,
city
,
province
,
district
,
address
,
userId
);
return
JsonResult
.
buildErrorStateResult
(
"参数不能为空"
,
null
);
}
Address
addressObj
=
addressService
.
findByUserId
(
userId
);
...
...
@@ -650,7 +733,8 @@ public class InnerController implements IBaseController {
public
JsonResult
updateMarryStatus
(
Long
userId
,
IncomeEnum
incomeEnum
,
IncomeRangeEnum
incomeRangeEnum
,
OccupationEnum
occupationEnum
,
EducationEnum
educationEnum
,
Boolean
hasCar
,
Boolean
hasSocialSecurity
,
Boolean
hasHouse
,
Boolean
hasCreditCard
,
MaritalStatus
maritalStatus
)
{
Boolean
hasSocialSecurity
,
Boolean
hasHouse
,
Boolean
hasCreditCard
,
MaritalStatus
maritalStatus
)
{
if
(
null
==
userId
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户ID不能为空"
,
null
);
}
...
...
@@ -663,14 +747,16 @@ public class InnerController implements IBaseController {
info
.
setIncomeEnum
(
cn
.
quantgroup
.
user
.
enums
.
IncomeEnum
.
valueOf
(
incomeEnum
.
name
()));
}
if
(
incomeRangeEnum
!=
null
)
{
info
.
setIncomeRangeEnum
(
cn
.
quantgroup
.
user
.
enums
.
IncomeRangeEnum
.
valueOf
(
incomeRangeEnum
.
name
()));
info
.
setIncomeRangeEnum
(
cn
.
quantgroup
.
user
.
enums
.
IncomeRangeEnum
.
valueOf
(
incomeRangeEnum
.
name
()));
}
if
(
occupationEnum
!=
null
)
{
if
(
occupationEnum
==
OccupationEnum
.
STUDENT
)
{
//如果是学生那么转成其他
occupationEnum
=
OccupationEnum
.
OTHER
;
}
//不明白为啥这么写 为啥不直接用还要valueof
info
.
setOccupationEnum
(
cn
.
quantgroup
.
user
.
enums
.
OccupationEnum
.
valueOf
(
occupationEnum
.
name
()));
info
.
setOccupationEnum
(
cn
.
quantgroup
.
user
.
enums
.
OccupationEnum
.
valueOf
(
occupationEnum
.
name
()));
}
if
(
educationEnum
!=
null
)
{
info
.
setEducationEnum
(
cn
.
quantgroup
.
user
.
enums
.
EducationEnum
.
valueOf
(
educationEnum
.
name
()));
...
...
@@ -686,7 +772,6 @@ public class InnerController implements IBaseController {
info
.
setHasSocialSecurity
(
hasSocialSecurity
);
}
if
(
hasHouse
!=
null
)
{
info
.
setHasHouse
(
hasHouse
);
}
...
...
@@ -709,8 +794,10 @@ public class InnerController implements IBaseController {
*/
@AccessForbiddenValidator
@RequestMapping
(
"/user_detail/search_list"
)
public
JsonResult
<
List
<
UserDetailVO
>>
searchUserDetailList
(
String
name
,
String
phoneNo
,
String
idNo
)
{
log
.
info
(
"searchUserDetailList ,param.name:{},phone:{},idNo:{},ip:{}"
,
name
,
phoneNo
,
idNo
,
getIp
());
public
JsonResult
<
List
<
UserDetailVO
>>
searchUserDetailList
(
String
name
,
String
phoneNo
,
String
idNo
)
{
log
.
info
(
"searchUserDetailList ,param.name:{},phone:{},idNo:{},ip:{}"
,
name
,
phoneNo
,
idNo
,
getIp
());
if
(
StringUtils
.
isBlank
(
name
)
&&
StringUtils
.
isBlank
(
phoneNo
)
&&
StringUtils
.
isBlank
(
idNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"至少必须满足一个条件不为空"
,
null
);
}
...
...
@@ -730,7 +817,8 @@ public class InnerController implements IBaseController {
public
JsonResult
<
List
<
UserDetail
>>
fuzzyQueryUserDetailList
(
String
phoneNo
,
String
idNo
,
String
userName
)
{
log
.
info
(
"fuzzyQueryUserDetailList, phone:{},idNo:{},userName:{},ip:{}"
,
phoneNo
,
idNo
,
userName
,
getIp
());
log
.
info
(
"fuzzyQueryUserDetailList, phone:{},idNo:{},userName:{},ip:{}"
,
phoneNo
,
idNo
,
userName
,
getIp
());
if
(
StringUtils
.
isBlank
(
phoneNo
)
&&
StringUtils
.
isBlank
(
idNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"查询条件不能为空"
,
null
);
}
...
...
@@ -739,8 +827,10 @@ public class InnerController implements IBaseController {
//最多掩码身份证后五位
int
idNoMaskSize
=
13
;
int
idNoFullSize
=
18
;
boolean
phoneNoValid
=
StringUtils
.
isBlank
(
phoneNo
)
?
false
:
(
phoneNo
.
length
()
>=
phoneNoMaskSize
||
ValidationUtil
.
validatePhoneNo
(
phoneNo
));
boolean
idNoValid
=
StringUtils
.
isBlank
(
idNo
)
?
false
:
(
idNo
.
length
()
>=
idNoMaskSize
||
Objects
.
equals
(
idNo
.
length
(),
idNoFullSize
));
boolean
phoneNoValid
=
StringUtils
.
isBlank
(
phoneNo
)
?
false
:
(
phoneNo
.
length
()
>=
phoneNoMaskSize
||
ValidationUtil
.
validatePhoneNo
(
phoneNo
));
boolean
idNoValid
=
StringUtils
.
isBlank
(
idNo
)
?
false
:
(
idNo
.
length
()
>=
idNoMaskSize
||
Objects
.
equals
(
idNo
.
length
(),
idNoFullSize
));
if
(!
phoneNoValid
&&
!
idNoValid
)
{
return
JsonResult
.
buildErrorStateResult
(
"查询条件不规范!"
,
null
);
}
...
...
@@ -754,7 +844,9 @@ public class InnerController implements IBaseController {
}
// 如果传入姓名,则只过滤匹配项
if
(!
CollectionUtils
.
isEmpty
(
userDetailList
)
&&
StringUtils
.
isNotBlank
(
userName
))
{
userDetailList
=
userDetailList
.
stream
().
filter
(
userDetail
->
Objects
.
equals
(
userName
,
userDetail
.
getName
())).
collect
(
Collectors
.
toList
());
userDetailList
=
userDetailList
.
stream
()
.
filter
(
userDetail
->
Objects
.
equals
(
userName
,
userDetail
.
getName
()))
.
collect
(
Collectors
.
toList
());
}
return
JsonResult
.
buildSuccessResult
(
"success"
,
userDetailList
);
}
...
...
@@ -790,11 +882,7 @@ public class InnerController implements IBaseController {
* @param id - 用户表主键
* @param phoneNo - 用户账号
* @param uuid - 用户全球唯一键(uuid)
* @return 详细信息包含:
* {
* 账号信息
* 个人信息
* }
* @return 详细信息包含: { 账号信息 个人信息 }
*/
@RequestMapping
(
"/user-association/search"
)
public
JsonResult
findUserAssociationModel
(
Long
id
,
String
phoneNo
,
String
uuid
)
{
...
...
@@ -821,14 +909,7 @@ public class InnerController implements IBaseController {
* 查询用户综合信息模型
*
* @param user - 用户User
* @return 综合信息模型包含:
* {
* 账号信息
* 个人信息
* 扩展信息
* 地址信息
* 联系人信息
* }
* @return 综合信息模型包含: { 账号信息 个人信息 扩展信息 地址信息 联系人信息 }
*/
private
UserAssociationModel
findUserAssociationModelByUser
(
User
user
)
{
if
(
Objects
.
isNull
(
user
)
||
Objects
.
isNull
(
user
.
getId
())
||
user
.
getId
()
<
1
)
{
...
...
@@ -854,15 +935,20 @@ public class InnerController implements IBaseController {
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
user
.
getId
());
if
(
Objects
.
nonNull
(
extInfo
))
{
// 婚姻状态
bean
.
setMarryStatus
(
Optional
.
ofNullable
(
extInfo
.
getMarryStatus
()).
orElse
(
cn
.
quantgroup
.
user
.
enums
.
MaritalStatus
.
UNKNOWN
).
getDesc
());
bean
.
setMarryStatus
(
Optional
.
ofNullable
(
extInfo
.
getMarryStatus
())
.
orElse
(
cn
.
quantgroup
.
user
.
enums
.
MaritalStatus
.
UNKNOWN
).
getDesc
());
// 受教育程度
bean
.
setEducationEnum
(
Optional
.
ofNullable
(
extInfo
.
getEducationEnum
()).
orElse
(
cn
.
quantgroup
.
user
.
enums
.
EducationEnum
.
UNKNOWN
).
getName
());
bean
.
setEducationEnum
(
Optional
.
ofNullable
(
extInfo
.
getEducationEnum
())
.
orElse
(
cn
.
quantgroup
.
user
.
enums
.
EducationEnum
.
UNKNOWN
).
getName
());
// 职业
bean
.
setOccupationEnum
(
Optional
.
ofNullable
(
extInfo
.
getOccupationEnum
()).
orElse
(
cn
.
quantgroup
.
user
.
enums
.
OccupationEnum
.
UNKNOWN
).
getName
());
bean
.
setOccupationEnum
(
Optional
.
ofNullable
(
extInfo
.
getOccupationEnum
())
.
orElse
(
cn
.
quantgroup
.
user
.
enums
.
OccupationEnum
.
UNKNOWN
).
getName
());
// 收入水平范围
bean
.
setIncomeRangeEnum
(
Optional
.
ofNullable
(
extInfo
.
getIncomeRangeEnum
()).
orElse
(
cn
.
quantgroup
.
user
.
enums
.
IncomeRangeEnum
.
UNKNOWN
).
getDesc
());
bean
.
setIncomeRangeEnum
(
Optional
.
ofNullable
(
extInfo
.
getIncomeRangeEnum
())
.
orElse
(
cn
.
quantgroup
.
user
.
enums
.
IncomeRangeEnum
.
UNKNOWN
).
getDesc
());
// 收入方式
bean
.
setIncomeEnum
(
Optional
.
ofNullable
(
extInfo
.
getIncomeEnum
()).
orElse
(
cn
.
quantgroup
.
user
.
enums
.
IncomeEnum
.
UNKNOWN
).
getDesc
());
bean
.
setIncomeEnum
(
Optional
.
ofNullable
(
extInfo
.
getIncomeEnum
())
.
orElse
(
cn
.
quantgroup
.
user
.
enums
.
IncomeEnum
.
UNKNOWN
).
getDesc
());
// 是否有车
bean
.
setHasCar
(
Optional
.
ofNullable
(
extInfo
.
getHasCar
()).
orElse
(
false
));
// 是否有社保
...
...
@@ -874,23 +960,28 @@ public class InnerController implements IBaseController {
}
Address
address
=
addressService
.
findByUserId
(
user
.
getId
());
if
(!
Objects
.
isNull
(
address
))
{
log
.
info
(
"[findUserAssociationModelByUser]获取用户地址address:{}"
,
JSON
.
toJSONString
(
address
));
log
.
info
(
"[findUserAssociationModelByUser]获取用户地址address:{}"
,
JSON
.
toJSONString
(
address
));
bean
.
putAddressList
(
Collections
.
singletonList
(
address
));
}
List
<
Contact
>
contacts
=
contactService
.
findByUserIdAndBizType
(
user
.
getId
(),
BizType
.
CASH
,
true
);
List
<
Contact
>
contacts
=
contactService
.
findByUserIdAndBizType
(
user
.
getId
(),
BizType
.
CASH
,
true
);
if
(!
Objects
.
isNull
(
contacts
))
{
bean
.
putContactList
(
contacts
);
}
return
bean
;
}
@RequestMapping
(
path
=
"/user-association/search/userId"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
JsonResult
findUserAssociationModelByUserId
(
@RequestParam
(
name
=
"userId"
,
required
=
false
)
Long
userId
,
@RequestMapping
(
path
=
"/user-association/search/userId"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
JsonResult
findUserAssociationModelByUserId
(
@RequestParam
(
name
=
"userId"
,
required
=
false
)
Long
userId
,
@RequestParam
(
name
=
"phoneNo"
,
required
=
false
)
String
phoneNo
)
{
boolean
userIdOk
=
Objects
.
nonNull
(
userId
)
&&
userId
>
0
;
boolean
phoneNoOk
=
ValidationUtil
.
validatePhoneNo
(
phoneNo
);
if
(!
userIdOk
&&
!
phoneNoOk
)
{
return
JsonResult
.
buildErrorStateResult
(
"params invalid"
,
String
.
valueOf
(
userId
).
concat
(
":"
).
concat
(
phoneNo
));
return
JsonResult
.
buildErrorStateResult
(
"params invalid"
,
String
.
valueOf
(
userId
).
concat
(
":"
).
concat
(
phoneNo
));
}
UserAssociationModel
bean
=
null
;
User
user
=
userIdOk
?
userService
.
findById
(
userId
)
:
userService
.
findByPhoneWithCache
(
phoneNo
);
...
...
@@ -935,7 +1026,8 @@ public class InnerController implements IBaseController {
UserAssociation
bean
=
new
UserAssociation
();
if
(
null
!=
userDetail
)
{
Address
address
=
addressService
.
findByUserId
(
userDetail
.
getUserId
());
List
<
Contact
>
contacts
=
contactService
.
findByUserIdAndBizType
(
userDetail
.
getUserId
(),
BizType
.
CASH
,
true
);
List
<
Contact
>
contacts
=
contactService
.
findByUserIdAndBizType
(
userDetail
.
getUserId
(),
BizType
.
CASH
,
true
);
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
userDetail
.
getUserId
());
bean
.
setUserId
(
userDetail
.
getUserId
());
bean
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
...
...
@@ -1007,7 +1099,8 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"手机号格式错误"
,
null
);
}
WechatUserInfo
wechatUserInfo
=
wechatService
.
findWechatUserInfoByPhoneNo
(
phoneNo
);
return
JsonResult
.
buildSuccessResult
(
null
,
null
==
wechatUserInfo
?
null
:
wechatUserInfo
.
getOpenId
());
return
JsonResult
.
buildSuccessResult
(
null
,
null
==
wechatUserInfo
?
null
:
wechatUserInfo
.
getOpenId
());
}
/**
...
...
@@ -1036,12 +1129,13 @@ public class InnerController implements IBaseController {
// 禁用微信
wechatService
.
forbiddenUserWeChat
(
userId
);
}
applicationEventPublisher
.
publishEvent
(
new
DisableActiveEvent
(
this
,
user
));
applicationEventPublisher
.
publishEvent
(
new
DisableActiveEvent
(
this
,
user
));
return
Objects
.
equals
(
enable
,
user
.
getEnable
());
}
@RequestMapping
(
"/user/spouse/save"
)
public
JsonResult
saveSpouse
(
Long
userId
,
MaritalStatus
status
,
String
spousePhone
,
String
spouseName
)
{
public
JsonResult
saveSpouse
(
Long
userId
,
MaritalStatus
status
,
String
spousePhone
,
String
spouseName
)
{
if
(
userId
==
null
||
userId
==
0
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户不能为空"
,
null
);
}
...
...
@@ -1089,7 +1183,8 @@ public class InnerController implements IBaseController {
if
(
phones
.
size
()
<=
MAX_SIZE
)
{
List
<
User
>
users
=
userService
.
findByPhones
(
phones
);
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
users
))
{
return
JsonResult
.
buildSuccessResult
(
null
,
users
.
stream
().
collect
(
Collectors
.
toMap
(
User:
:
getPhoneNo
,
User:
:
getId
)));
return
JsonResult
.
buildSuccessResult
(
null
,
users
.
stream
().
collect
(
Collectors
.
toMap
(
User:
:
getPhoneNo
,
User:
:
getId
)));
}
else
{
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
}
...
...
@@ -1141,7 +1236,10 @@ public class InnerController implements IBaseController {
* 保存用户信息,其中地址信息和联系人信息为非必要条件;注意:如果同时提供了province和address字段则需要保证Address的完整
*/
@RequestMapping
(
"/user/save_multi"
)
public
JsonResult
saveMulti
(
String
registeredFrom
,
String
channelId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
provinceCode
,
String
province
,
String
cityCode
,
String
city
,
String
districtCode
,
String
district
,
String
address
,
String
contacts
,
@RequestParam
(
defaultValue
=
"0"
,
required
=
false
)
Long
btRegisterChannelId
)
{
public
JsonResult
saveMulti
(
String
registeredFrom
,
String
channelId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
provinceCode
,
String
province
,
String
cityCode
,
String
city
,
String
districtCode
,
String
district
,
String
address
,
String
contacts
,
@RequestParam
(
defaultValue
=
"0"
,
required
=
false
)
Long
btRegisterChannelId
)
{
if
(!
NumberUtils
.
isDigits
(
registeredFrom
))
{
return
JsonResult
.
buildErrorStateResult
(
"注册渠道异常."
,
null
);
}
...
...
@@ -1212,7 +1310,8 @@ public class InnerController implements IBaseController {
}
}
}
user
=
userRegisterService
.
register
(
Long
.
valueOf
(
registeredFrom
),
Long
.
valueOf
(
channelId
),
phoneNo
,
name
,
idNo
,
addressObj
,
contacts
,
contactList
,
btRegisterChannelId
);
user
=
userRegisterService
.
register
(
Long
.
valueOf
(
registeredFrom
),
Long
.
valueOf
(
channelId
),
phoneNo
,
name
,
idNo
,
addressObj
,
contacts
,
contactList
,
btRegisterChannelId
);
UserRet
userRet
=
new
UserRet
(
user
);
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
}
...
...
@@ -1228,9 +1327,7 @@ public class InnerController implements IBaseController {
}
/**
* 技术网关 - 验证手机号和验证码是否匹配
* 仅供可信任的内部服务调用,不执行限次记数、销毁等安全策略
* 注意:只使用于快速登录类似场景调用
* 技术网关 - 验证手机号和验证码是否匹配 仅供可信任的内部服务调用,不执行限次记数、销毁等安全策略 注意:只使用于快速登录类似场景调用
*
* @param phoneNo 手机号
* @param verificationCode 验证码(短信/语音)
...
...
@@ -1245,7 +1342,10 @@ public class InnerController implements IBaseController {
@RequestParam
(
required
=
false
,
defaultValue
=
"xyqb"
)
String
key
,
@RequestParam
(
required
=
false
)
Long
btRegisterChannelId
,
@RequestParam
(
required
=
false
)
String
dimension
)
{
log
.
info
(
"/innerapi/verifyPhoneAndCode -> phoneNo:{},verificationCode:{},channelId:{},appChannel:{},createdFrom:{},btRegisterChannelId:{},key:{},dimension:{}"
,
phoneNo
,
verificationCode
,
channelId
,
appChannel
,
createdFrom
,
btRegisterChannelId
,
key
,
dimension
);
log
.
info
(
"/innerapi/verifyPhoneAndCode -> phoneNo:{},verificationCode:{},channelId:{},appChannel:{},createdFrom:{},btRegisterChannelId:{},key:{},dimension:{}"
,
phoneNo
,
verificationCode
,
channelId
,
appChannel
,
createdFrom
,
btRegisterChannelId
,
key
,
dimension
);
// 验证接入方
Merchant
merchant
=
merchantService
.
findMerchantByName
(
key
);
if
(
merchant
==
null
)
{
...
...
@@ -1273,7 +1373,8 @@ public class InnerController implements IBaseController {
}
// 用户不存在时自动注册
if
(
Objects
.
isNull
(
user
))
{
user
=
userRegisterService
.
register
(
phoneNo
,
channelId
,
createdFrom
,
appChannel
,
btRegisterChannelId
,
dimension
);
user
=
userRegisterService
.
register
(
phoneNo
,
channelId
,
createdFrom
,
appChannel
,
btRegisterChannelId
,
dimension
);
// 注册失败
if
(
Objects
.
isNull
(
user
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户不存在"
,
""
);
...
...
@@ -1358,51 +1459,104 @@ public class InnerController implements IBaseController {
}
/**
* 激活/启用 用户
* -- 供内部系统免密调用
* 激活/启用 用户 -- 供内部系统免密调用
*
* @param userId
* @return
*/
@RequestMapping
(
path
=
"/user/active"
,
method
=
RequestMethod
.
POST
)
public
JsonResult
activeUser
(
Long
userId
)
{
public
JsonResult
activeUser
(
Long
userId
,
@RequestHeader
(
value
=
"Access-Token"
,
required
=
false
)
String
accessToken
)
{
boolean
flushed
=
flushUserStatus
(
userId
,
true
);
UserDisableRecord
userDisableRecord
=
new
UserDisableRecord
();
userDisableRecord
.
setUserId
(
userId
);
if
(
StringUtils
.
isNotEmpty
(
accessToken
))
{
LoginUserContext
loginUserContext
=
getLoginUserContextFromStms
(
accessToken
);
userDisableRecord
.
setCreatedBy
(
loginUserContext
.
getUserName
());
userDisableRecord
.
setUpdatedBy
(
loginUserContext
.
getUserName
());
}
userDisableRecord
.
setOperation_type
((
short
)
1
);
applicationEventPublisher
.
publishEvent
(
new
UserDisableRecordEvent
(
this
,
userDisableRecord
));
log
.
info
(
"激活/启用 用户,userId:[{}],result:[{}]"
,
userId
,
flushed
);
return
JsonResult
.
buildSuccessResult
(
"用户已激活."
,
flushed
);
}
/**
* 注销/禁用 用户
* -- 供内部系统免密调用
* 注销/禁用 用户 -- 供内部系统免密调用
*
* @param userId
* @return
*/
@RequestMapping
(
path
=
"/user/disable"
,
method
=
RequestMethod
.
POST
)
public
JsonResult
forbiddenUser
(
Long
userId
)
{
public
JsonResult
forbiddenUser
(
Long
userId
,
@Length
(
max
=
10
,
message
=
"原因不能大于10个字符"
)
String
reason
,
@RequestHeader
(
value
=
"Access-Token"
,
required
=
false
)
String
accessToken
)
{
boolean
flushed
=
flushUserStatus
(
userId
,
false
);
UserDisableRecord
userDisableRecord
=
new
UserDisableRecord
();
userDisableRecord
.
setUserId
(
userId
);
if
(
StringUtils
.
isNotEmpty
(
accessToken
))
{
LoginUserContext
loginUserContext
=
getLoginUserContextFromStms
(
accessToken
);
userDisableRecord
.
setCreatedBy
(
loginUserContext
.
getUserName
());
userDisableRecord
.
setUpdatedBy
(
loginUserContext
.
getUserName
());
}
userDisableRecord
.
setReason
(
reason
);
userDisableRecord
.
setOperation_type
((
short
)
0
);
applicationEventPublisher
.
publishEvent
(
new
UserDisableRecordEvent
(
this
,
userDisableRecord
));
log
.
info
(
"注销/禁用 用户,userId:[{}],result:[{}]"
,
userId
,
flushed
);
return
JsonResult
.
buildSuccessResult
(
"用户已禁用."
,
flushed
);
}
/**
* 重置用户实名信息接口
* -- 供内部系统免密调用
* 根据用户id获取操作用户冻结记录列表
*
* @param userId 用户id
* @return List<UserDisableRecord>
*/
@RequestMapping
(
path
=
"/user/records/{userId}"
,
method
=
RequestMethod
.
POST
)
public
JsonResult
disableRecordList
(
@PathVariable
(
"userId"
)
Long
userId
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"0"
)
Integer
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"20"
)
Integer
size
)
{
Pageable
pageable
=
new
PageRequest
(
page
,
size
);
return
JsonResult
.
buildSuccessResultGeneric
(
iUserDisableRecordRepository
.
findByUserIdOrderByCreatedAtDesc
(
userId
,
pageable
).
map
(
UserDisableRecordModel:
:
from
));
}
private
LoginUserContext
getLoginUserContextFromStms
(
String
accessToken
)
{
LoginUserContext
loginUserContext
=
new
LoginUserContext
();
OauthResult
oauthResult
=
stmsRemoteService
.
checkToken
(
accessToken
);
if
(
oauthResult
==
null
||
!
Objects
.
equals
(
2000
,
oauthResult
.
getCode
()))
{
throw
new
UserNotExistException
(
"stms用户异常,请检查token"
);
}
else
{
LinkedHashMap
onlineUser
=
(
LinkedHashMap
)
oauthResult
.
getData
();
loginUserContext
.
setUserId
(
onlineUser
.
get
(
"id"
).
toString
());
loginUserContext
.
setUserName
(
String
.
valueOf
(
onlineUser
.
get
(
"account"
)));
}
return
loginUserContext
;
}
/**
* 重置用户实名信息接口 -- 供内部系统免密调用
*
* @param userId - 用户主键
* @param idNo - 身份证号
* @param name - 姓名
*/
@RequestMapping
(
path
=
"/userDetail/reset/{userId}"
,
method
=
RequestMethod
.
POST
)
public
JsonResult
resetName
(
@PathVariable
(
"userId"
)
Long
userId
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"idNo"
)
String
idNo
)
{
public
JsonResult
resetName
(
@PathVariable
(
"userId"
)
Long
userId
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"idNo"
)
String
idNo
)
{
log
.
info
(
"重置用户实名信息 userId:{},name:{},idNo:{}"
,
userId
,
name
,
idNo
);
if
(
Objects
.
nonNull
(
userId
)
&&
ValidationUtil
.
validateChinese
(
name
))
{
try
{
User
user
=
userService
.
findById
(
userId
);
int
rows
=
userDetailService
.
updateNameAndIdCard
(
name
,
idNo
,
user
.
getPhoneNo
());
log
.
info
(
"重置用户实名信息,userId:{},name:{},idNo:{},result:[{}]"
,
userId
,
name
,
idNo
,
rows
);
log
.
info
(
"重置用户实名信息,userId:{},name:{},idNo:{},result:[{}]"
,
userId
,
name
,
idNo
,
rows
);
if
(
rows
>
0
)
{
return
JsonResult
.
buildSuccessResult
(
"用户实名信息已重置."
,
name
.
concat
(
","
).
concat
(
idNo
).
concat
(
","
).
concat
(
userId
.
toString
()));
return
JsonResult
.
buildSuccessResult
(
"用户实名信息已重置."
,
name
.
concat
(
","
).
concat
(
idNo
).
concat
(
","
).
concat
(
userId
.
toString
()));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"用户实名信息重置失败,userId[{}],name[{}],err:[{}]"
,
userId
,
name
,
e
);
...
...
@@ -1414,11 +1568,11 @@ public class InnerController implements IBaseController {
}
/**
* 重置密码接口
* -- 供内部系统免密调用
* 重置密码接口 -- 供内部系统免密调用
*/
@RequestMapping
(
path
=
"/user/password/reset"
,
method
=
RequestMethod
.
POST
)
public
JsonResult
resetPassword
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
required
=
false
)
String
password
)
{
public
JsonResult
resetPassword
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
required
=
false
)
String
password
)
{
if
(
ValidationUtil
.
validatePhoneNo
(
phone
))
{
// 默认重置的密码是123456
if
(
StringUtils
.
isBlank
(
password
))
{
...
...
@@ -1440,11 +1594,11 @@ public class InnerController implements IBaseController {
}
/**
* 修改实名信息接口
* -- 供内部人员使用(例如绝影)
* 修改实名信息接口 -- 供内部人员使用(例如绝影)
*/
@RequestMapping
(
"/updateIdCard"
)
public
JsonResult
updateIdCard
(
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
idNo
,
public
JsonResult
updateIdCard
(
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
idNo
,
@RequestParam
String
phoneNo
,
@RequestParam
String
reason
,
@RequestParam
String
content
)
{
//密文
if
(
null
!=
content
)
{
...
...
@@ -1467,9 +1621,11 @@ public class InnerController implements IBaseController {
log
.
info
(
"重置用户实名信息 phoneNo:{},name:{},idNo:{}"
,
phoneNo
,
name
,
idNo
);
try
{
int
rows
=
userDetailService
.
updateNameAndIdCard
(
name
,
idNo
,
phoneNo
);
log
.
info
(
"重置用户实名信息,phoneNo:{},name:{},idNo:{},result:[{}],操作的理由reason:{}"
,
phoneNo
,
name
,
idNo
,
rows
,
reason
);
log
.
info
(
"重置用户实名信息,phoneNo:{},name:{},idNo:{},result:[{}],操作的理由reason:{}"
,
phoneNo
,
name
,
idNo
,
rows
,
reason
);
if
(
rows
>
0
)
{
return
JsonResult
.
buildSuccessResult
(
"用户实名信息已重置."
,
phoneNo
.
concat
(
","
).
concat
(
name
).
concat
(
","
).
concat
(
idNo
));
return
JsonResult
.
buildSuccessResult
(
"用户实名信息已重置."
,
phoneNo
.
concat
(
","
).
concat
(
name
).
concat
(
","
).
concat
(
idNo
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"用户实名信息重置失败,phoneNo[{}],name[{}],err:[{}]"
,
phoneNo
,
name
,
e
);
...
...
@@ -1478,11 +1634,11 @@ public class InnerController implements IBaseController {
}
/**
* 重置密码接口
* -- 供内部人员使用(例如绝影)
* 重置密码接口 -- 供内部人员使用(例如绝影)
*/
@RequestMapping
(
"/user/password/reset/{key}/{phone}"
)
public
JsonResult
resetPasswordByKey
(
@PathVariable
(
"key"
)
String
key
,
@PathVariable
(
"phone"
)
String
phone
)
{
public
JsonResult
resetPasswordByKey
(
@PathVariable
(
"key"
)
String
key
,
@PathVariable
(
"phone"
)
String
phone
)
{
log
.
info
(
"密码重置请求,phone:[{}]"
,
phone
);
if
(!
RESET_PWD_TOKEN
.
equalsIgnoreCase
(
key
))
{
log
.
error
(
"密码重置失败,key错误!@!,phone:[{}]"
,
phone
);
...
...
@@ -1492,8 +1648,7 @@ public class InnerController implements IBaseController {
}
/**
* 注销/禁用 用户
* -- 供内部人员使用(例如绝影)
* 注销/禁用 用户 -- 供内部人员使用(例如绝影)
*
* @param phoneNo
* @param enable
...
...
@@ -1513,7 +1668,8 @@ public class InnerController implements IBaseController {
}
String
str
=
AesUtil
.
decryptAfterBase64Decode
(
content
,
Constants
.
AES_KEY
);
if
(
null
==
str
||
!
str
.
equals
(
phoneNo
))
{
log
.
info
(
"[forbiddenUserOrNot][禁用或激活用户]:解密有误, phoneNo:{},aes:{}"
,
phoneNo
,
AesUtil
.
encryptAndBase64Encode
(
phoneNo
,
Constants
.
AES_KEY
));
log
.
info
(
"[forbiddenUserOrNot][禁用或激活用户]:解密有误, phoneNo:{},aes:{}"
,
phoneNo
,
AesUtil
.
encryptAndBase64Encode
(
phoneNo
,
Constants
.
AES_KEY
));
return
JsonResult
.
buildErrorStateResult
(
"解密有误"
,
null
);
}
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
...
...
@@ -1529,13 +1685,14 @@ public class InnerController implements IBaseController {
// 禁用微信
wechatService
.
forbiddenUserWeChat
(
user
.
getId
());
}
log
.
info
(
"[forbiddenUserOrNot][禁用或激活用户]:理由:reason:{},手机号phoneNo:{},受影响的行数affectedRows:{}"
,
reason
,
phoneNo
,
affectedRows
);
log
.
info
(
"[forbiddenUserOrNot][禁用或激活用户]:理由:reason:{},手机号phoneNo:{},受影响的行数affectedRows:{}"
,
reason
,
phoneNo
,
affectedRows
);
return
JsonResult
.
buildSuccessResult
(
"用户禁用或重启成功成功"
,
affectedRows
);
}
/**
* 清除微信关联
* -- 供内部人员使用(例如绝影)
* 清除微信关联 -- 供内部人员使用(例如绝影)
*
* @param userId
* @param reason
...
...
@@ -1543,7 +1700,8 @@ public class InnerController implements IBaseController {
* @return
*/
@RequestMapping
(
"/forbiddenUserWeChat"
)
public
JsonResult
forbiddenUserWeChat
(
@RequestParam
Long
userId
,
@RequestParam
String
reason
,
@RequestParam
String
content
)
{
public
JsonResult
forbiddenUserWeChat
(
@RequestParam
Long
userId
,
@RequestParam
String
reason
,
@RequestParam
String
content
)
{
if
(
StringUtils
.
isBlank
(
reason
)
||
null
==
userId
||
userId
<=
0
)
{
return
JsonResult
.
buildErrorStateResult
(
"参数有误"
,
null
);
}
...
...
@@ -1556,12 +1714,13 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"解密有误"
,
null
);
}
int
affectedRows
=
wechatService
.
forbiddenUserWeChat
(
userId
);
log
.
info
(
"用户微信禁用,userId:{},禁用的原因reason:{},受影响的行数affectedRows:{}"
,
userId
,
reason
,
affectedRows
);
log
.
info
(
"用户微信禁用,userId:{},禁用的原因reason:{},受影响的行数affectedRows:{}"
,
userId
,
reason
,
affectedRows
);
return
JsonResult
.
buildSuccessResult
(
"用户禁用微信成功"
,
affectedRows
);
}
// @RequestMapping("/clean")
public
JsonResult
clean
()
{
// @RequestMapping("/clean")
public
JsonResult
clean
()
{
cleanDataService
.
cleanData
();
return
JsonResult
.
buildSuccessResult
(
"已经开始清洗"
);
}
...
...
@@ -1587,11 +1746,12 @@ public class InnerController implements IBaseController {
/**
* 测试定时删除注销记录
*
* @return
*/
@PostMapping
(
"/user/deleteDeregister"
)
public
JsonResult
<?>
deleteDeregister
()
{
userDeregisterService
.
executeTask
();
return
JsonResult
.
buildSuccessResult
(
"用户销户成功1231"
,
true
);
return
JsonResult
.
buildSuccessResult
(
"用户销户成功1231"
,
true
);
}
}
\ No newline at end of file
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/user/UserController.java
View file @
16363d0f
...
...
@@ -10,6 +10,7 @@ import java.util.List;
import
java.util.Map
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.hibernate.validator.constraints.Length
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
...
...
src/main/java/cn/quantgroup/xyqb/entity/UserDisableRecord.java
0 → 100644
View file @
16363d0f
package
cn
.
quantgroup
.
xyqb
.
entity
;
import
java.io.Serializable
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
lombok.Data
;
@Data
@Entity
@Table
(
name
=
"user_disable_record"
)
public
class
UserDisableRecord
extends
BaseEntity
implements
Serializable
{
@Column
(
name
=
"user_id"
)
private
Long
userId
;
@Column
(
name
=
"operation_type"
)
private
short
operation_type
;
@Column
(
name
=
"reason"
)
private
String
reason
;
@Column
(
name
=
"created_by"
)
private
String
createdBy
;
@Column
(
name
=
"updated_by"
)
private
String
updatedBy
;
}
src/main/java/cn/quantgroup/xyqb/event/UserDisableRecordEvent.java
0 → 100644
View file @
16363d0f
package
cn
.
quantgroup
.
xyqb
.
event
;
import
cn.quantgroup.xyqb.entity.UserDisableRecord
;
import
lombok.Getter
;
import
org.springframework.context.ApplicationEvent
;
@Getter
public
class
UserDisableRecordEvent
extends
ApplicationEvent
{
private
UserDisableRecord
userDisableRecord
;
public
UserDisableRecordEvent
(
Object
source
)
{
super
(
source
);
}
public
UserDisableRecordEvent
(
Object
source
,
UserDisableRecord
userDisableRecord
)
{
super
(
source
);
this
.
userDisableRecord
=
userDisableRecord
;
}
}
\ No newline at end of file
src/main/java/cn/quantgroup/xyqb/event/UserDisableRecordListener.java
0 → 100644
View file @
16363d0f
package
cn
.
quantgroup
.
xyqb
.
event
;
import
cn.quantgroup.xyqb.repository.IUserDisableRecordRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
@Component
@Async
public
class
UserDisableRecordListener
implements
ApplicationListener
<
UserDisableRecordEvent
>
{
@Autowired
private
IUserDisableRecordRepository
iUserDisableRecordRepository
;
@Override
public
void
onApplicationEvent
(
UserDisableRecordEvent
userDisableRecordEvent
)
{
iUserDisableRecordRepository
.
save
(
userDisableRecordEvent
.
getUserDisableRecord
());
}
}
\ No newline at end of file
src/main/java/cn/quantgroup/xyqb/model/LoginUserContext.java
0 → 100644
View file @
16363d0f
package
cn
.
quantgroup
.
xyqb
.
model
;
import
lombok.Data
;
import
org.springframework.stereotype.Component
;
@Component
@Data
public
class
LoginUserContext
{
private
String
userId
;
private
String
userName
;
}
src/main/java/cn/quantgroup/xyqb/model/OauthResult.java
0 → 100644
View file @
16363d0f
package
cn
.
quantgroup
.
xyqb
.
model
;
import
lombok.Data
;
@Data
public
class
OauthResult
implements
java
.
io
.
Serializable
{
private
Integer
code
;
/** 业务异常相应码,前端需要依据这个做相应处理 **/
private
Integer
businessCode
;
/** 消息 **/
private
String
msg
;
/** 详细消息 **/
private
String
detail
;
/** 数据 **/
private
Object
data
;
}
src/main/java/cn/quantgroup/xyqb/model/UserDisableRecordModel.java
0 → 100644
View file @
16363d0f
package
cn
.
quantgroup
.
xyqb
.
model
;
import
cn.quantgroup.xyqb.entity.UserDisableRecord
;
import
java.time.format.DateTimeFormatter
;
import
lombok.Data
;
/**
* 只是为了兼容时间格式化问题,后续用户中心升级后,该model不需要
*/
@Data
public
class
UserDisableRecordModel
{
private
Long
id
;
private
Long
userId
;
private
short
operation_type
;
private
String
reason
;
private
String
createdBy
;
private
String
updatedBy
;
private
String
createdAt
;
private
String
updatedAt
;
public
static
UserDisableRecordModel
from
(
UserDisableRecord
userDisableRecord
){
UserDisableRecordModel
userDisableRecordModel
=
new
UserDisableRecordModel
();
userDisableRecordModel
.
setUserId
(
userDisableRecord
.
getUserId
());
userDisableRecordModel
.
setId
(
userDisableRecord
.
getId
());
userDisableRecordModel
.
setReason
(
userDisableRecord
.
getReason
());
userDisableRecordModel
.
setOperation_type
(
userDisableRecord
.
getOperation_type
());
userDisableRecordModel
.
setCreatedAt
(
userDisableRecord
.
getCreatedAt
().
toLocalDateTime
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
userDisableRecordModel
.
setUpdatedAt
(
userDisableRecord
.
getUpdatedAt
().
toLocalDateTime
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
userDisableRecordModel
.
setCreatedBy
(
userDisableRecord
.
getCreatedBy
());
userDisableRecordModel
.
setUpdatedBy
(
userDisableRecord
.
getUpdatedBy
());
return
userDisableRecordModel
;
}
}
src/main/java/cn/quantgroup/xyqb/remote/StmsRemoteService.java
0 → 100644
View file @
16363d0f
package
cn
.
quantgroup
.
xyqb
.
remote
;
import
cn.quantgroup.xyqb.model.OauthResult
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestHeader
;
@FeignClient
(
name
=
"stms"
,
url
=
"${stms.https}"
)
public
interface
StmsRemoteService
{
@PostMapping
(
"/v2/oauth/currentuserinfo"
)
OauthResult
checkToken
(
@RequestHeader
(
"Access-Token"
)
String
accessToken
);
}
src/main/java/cn/quantgroup/xyqb/repository/IUserDisableRecordRepository.java
0 → 100644
View file @
16363d0f
package
cn
.
quantgroup
.
xyqb
.
repository
;
import
cn.quantgroup.xyqb.entity.UserDisableRecord
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
public
interface
IUserDisableRecordRepository
extends
JpaRepository
<
UserDisableRecord
,
Long
>,
JpaSpecificationExecutor
<
UserDisableRecord
>
{
Page
<
UserDisableRecord
>
findByUserIdOrderByCreatedAtDesc
(
Long
userId
,
Pageable
pageable
);
}
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