This commit is contained in:
MaxKey
2022-04-13 18:47:33 +08:00
parent 3e0764c7cf
commit 786ca40b3c
95 changed files with 1146 additions and 513 deletions

View File

@@ -32,8 +32,8 @@ import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
@Component
public class MqPersistService {
private static final Logger _logger = LoggerFactory.getLogger(MqPersistService.class);
public class MessageQueueService {
private static final Logger _logger = LoggerFactory.getLogger(MessageQueueService.class);
@Autowired
protected ApplicationConfig applicationConfig;

View File

@@ -29,7 +29,7 @@ import org.maxkey.entity.UserInfo;
import org.maxkey.persistence.mapper.AccountsMapper;
import org.maxkey.persistence.mq.MqIdentityAction;
import org.maxkey.persistence.mq.MqIdentityTopic;
import org.maxkey.persistence.mq.MqPersistService;
import org.maxkey.persistence.mq.MessageQueueService;
import org.maxkey.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -45,7 +45,7 @@ import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombi
public class AccountsService extends JpaBaseService<Accounts>{
@Autowired
MqPersistService mqPersistService;
MessageQueueService mqPersistService;
@Autowired
UserInfoService userInfoService;

View File

@@ -1,5 +1,5 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -26,7 +26,7 @@ import org.maxkey.entity.Organizations;
import org.maxkey.persistence.mapper.OrganizationsMapper;
import org.maxkey.persistence.mq.MqIdentityAction;
import org.maxkey.persistence.mq.MqIdentityTopic;
import org.maxkey.persistence.mq.MqPersistService;
import org.maxkey.persistence.mq.MessageQueueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -35,7 +35,7 @@ import org.springframework.stereotype.Repository;
public class OrganizationsService extends JpaBaseService<Organizations>{
@Autowired
MqPersistService mqPersistService;
MessageQueueService messageQueueService;
public OrganizationsService() {
super(OrganizationsMapper.class);
@@ -51,7 +51,7 @@ public class OrganizationsService extends JpaBaseService<Organizations>{
public boolean insert(Organizations organization) {
if(super.insert(organization)){
mqPersistService.send(
messageQueueService.send(
MqIdentityTopic.ORG_TOPIC, organization, MqIdentityAction.CREATE_ACTION);
return true;
}
@@ -60,7 +60,7 @@ public class OrganizationsService extends JpaBaseService<Organizations>{
public boolean update(Organizations organization) {
if(super.update(organization)){
mqPersistService.send(
messageQueueService.send(
MqIdentityTopic.ORG_TOPIC, organization, MqIdentityAction.UPDATE_ACTION);
return true;
}
@@ -84,7 +84,7 @@ public class OrganizationsService extends JpaBaseService<Organizations>{
public boolean delete(Organizations organization) {
if(super.delete(organization)){
mqPersistService.send(
messageQueueService.send(
MqIdentityTopic.ORG_TOPIC, organization, MqIdentityAction.DELETE_ACTION);
return true;
}

View File

@@ -29,7 +29,7 @@ import org.maxkey.entity.UserInfo;
import org.maxkey.persistence.mapper.UserInfoMapper;
import org.maxkey.persistence.mq.MqIdentityAction;
import org.maxkey.persistence.mq.MqIdentityTopic;
import org.maxkey.persistence.mq.MqPersistService;
import org.maxkey.persistence.mq.MessageQueueService;
import org.maxkey.persistence.repository.PasswordPolicyValidator;
import org.maxkey.util.DateUtils;
import org.maxkey.util.StringUtils;
@@ -37,7 +37,6 @@ import org.maxkey.web.WebContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Repository;
@@ -57,12 +56,9 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
PasswordPolicyValidator passwordPolicyValidator;
@Autowired
MqPersistService mqPersistService;
@Autowired
protected JdbcTemplate jdbcTemplate;
AccountsService accountsService;
MessageQueueService messageQueueService;
AccountsService accountsService;
public UserInfoService() {
super(UserInfoMapper.class);
@@ -79,9 +75,9 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
public boolean insert(UserInfo userInfo) {
this.passwordEncoder(userInfo);
if (super.insert(userInfo)) {
if(mqPersistService.getApplicationConfig().isMessageQueueSupport()) {
if(messageQueueService.getApplicationConfig().isMessageQueueSupport()) {
UserInfo loadUserInfo = findUserRelated(userInfo.getId());
mqPersistService.send(
messageQueueService.send(
MqIdentityTopic.USERINFO_TOPIC,
loadUserInfo,
MqIdentityAction.CREATE_ACTION);
@@ -96,10 +92,10 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
public boolean update(UserInfo userInfo) {
ChangePassword changePassword = this.passwordEncoder(userInfo);
if (super.update(userInfo)) {
if(mqPersistService.getApplicationConfig().isMessageQueueSupport()) {
if(messageQueueService.getApplicationConfig().isMessageQueueSupport()) {
UserInfo loadUserInfo = findUserRelated(userInfo.getId());
accountUpdate(loadUserInfo);
mqPersistService.send(
messageQueueService.send(
MqIdentityTopic.USERINFO_TOPIC,
loadUserInfo,
MqIdentityAction.UPDATE_ACTION);
@@ -113,12 +109,12 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
public boolean delete(UserInfo userInfo) {
UserInfo loadUserInfo = null;
if(mqPersistService.getApplicationConfig().isMessageQueueSupport()) {
if(messageQueueService.getApplicationConfig().isMessageQueueSupport()) {
loadUserInfo = findUserRelated(userInfo.getId());
}
if( super.delete(userInfo)){
mqPersistService.send(
messageQueueService.send(
MqIdentityTopic.USERINFO_TOPIC,
loadUserInfo,
MqIdentityAction.DELETE_ACTION);
@@ -313,7 +309,7 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
if(changePassworded !=null && StringUtils.isNotBlank(changePassworded.getPassword())) {
UserInfo loadUserInfo = findByUsername(changePassworded.getUsername());
ChangePassword changePassword = new ChangePassword(loadUserInfo);
mqPersistService.send(
messageQueueService.send(
MqIdentityTopic.PASSWORD_TOPIC,
changePassword,
MqIdentityAction.PASSWORD_ACTION);