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
e234dd6c
Commit
e234dd6c
authored
Jan 12, 2023
by
王亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature disable user 20230105
parent
bc21a908
Changes
13
Hide 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 @
e234dd6c
...
...
@@ -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 @
e234dd6c
...
...
@@ -73,14 +73,13 @@ public class HttpConfig {
public
Jackson2ObjectMapperBuilder
jacksonBuilder
()
{
Jackson2ObjectMapperBuilder
builder
=
new
Jackson2ObjectMapperBuilder
();
builder
.
indentOutput
(
false
)
.
dateFormat
(
new
SimpleDateFormat
(
"yyyy-MM-dd"
))
.
defaultViewInclusion
(
false
)
.
serializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
)
.
featuresToEnable
(
SerializationFeature
.
WRITE_ENUMS_USING_INDEX
,
DeserializationFeature
.
ACCEPT_EMPTY_STRING_AS_NULL_OBJECT
);
.
dateFormat
(
new
SimpleDateFormat
(
"yyyy-MM-dd"
))
.
defaultViewInclusion
(
false
)
.
serializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
)
.
featuresToEnable
(
SerializationFeature
.
WRITE_ENUMS_USING_INDEX
,
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 @
e234dd6c
...
...
@@ -13,25 +13,31 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Component
public
class
MyWebMvcConfigurer
extends
WebMvcConfigurerAdapter
{
@Override
public
void
addFormatters
(
FormatterRegistry
registry
)
{
registry
.
removeConvertible
(
String
.
class
,
Enum
.
class
);
registry
.
addConverterFactory
(
new
IntegerToEnumConverterFactory
());
}
@Override
public
void
addFormatters
(
FormatterRegistry
registry
)
{
registry
.
removeConvertible
(
String
.
class
,
Enum
.
class
);
registry
.
addConverterFactory
(
new
IntegerToEnumConverterFactory
());
}
/**
* 快速校验参数. 第一个出错后面的不用再校验了
* @return
*/
@Bean
public
MethodValidationPostProcessor
methodValidationPostProcessor
()
{
MethodValidationPostProcessor
postProcessor
=
new
MethodValidationPostProcessor
();
ValidatorFactory
validatorFactory
=
Validation
.
byProvider
(
HibernateValidator
.
class
)
.
configure
()
.
addProperty
(
"hibernate.validator.fail_fast"
,
"true"
)
.
buildValidatorFactory
();
Validator
validator
=
validatorFactory
.
getValidator
();
postProcessor
.
setValidator
(
validator
);
return
postProcessor
;
}
/**
* 快速校验参数. 第一个出错后面的不用再校验了
*
* @return
*/
@Bean
public
MethodValidationPostProcessor
methodValidationPostProcessor
()
{
MethodValidationPostProcessor
postProcessor
=
new
MethodValidationPostProcessor
();
ValidatorFactory
validatorFactory
=
Validation
.
byProvider
(
HibernateValidator
.
class
)
.
configure
()
.
addProperty
(
"hibernate.validator.fail_fast"
,
"true"
)
.
buildValidatorFactory
();
Validator
validator
=
validatorFactory
.
getValidator
();
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 @
e234dd6c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/user/UserController.java
View file @
e234dd6c
...
...
@@ -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 @
e234dd6c
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 @
e234dd6c
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 @
e234dd6c
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 @
e234dd6c
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 @
e234dd6c
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 @
e234dd6c
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 @
e234dd6c
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 @
e234dd6c
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