diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentDeleteAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentDeleteAfterHandlerImpl.java index c728672..b1c95cb 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentDeleteAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentDeleteAfterHandlerImpl.java @@ -5,6 +5,7 @@ import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.department.IDepartmentDeleteAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import ink.wgink.util.string.WStringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -26,9 +27,14 @@ public class DepartmentDeleteAfterHandlerImpl implements IDepartmentDeleteAfterH @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(List departmentIds) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (departmentIds == null || departmentIds.isEmpty()) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentSaveAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentSaveAfterHandlerImpl.java index 3b8e4fe..34386c4 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentSaveAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentSaveAfterHandlerImpl.java @@ -5,6 +5,7 @@ import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.department.IDepartmentSaveAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -25,9 +26,14 @@ public class DepartmentSaveAfterHandlerImpl implements IDepartmentSaveAfterHandl @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(String departmentId, String departmentParentId, String departmentName, String departmentCode, Integer departmentType, String departmentAreaCode, String departmentAreaName) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (StringUtils.isBlank(departmentId)) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentUpdateAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentUpdateAfterHandlerImpl.java index dda5cd9..a390104 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentUpdateAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/DepartmentUpdateAfterHandlerImpl.java @@ -5,6 +5,7 @@ import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.department.IDepartmentUpdateAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -25,6 +26,8 @@ public class DepartmentUpdateAfterHandlerImpl implements IDepartmentUpdateAfterH @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(String departmentId, @@ -33,6 +36,9 @@ public class DepartmentUpdateAfterHandlerImpl implements IDepartmentUpdateAfterH Integer departmentType, String departmentAreaCode, String departmentAreaName) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (StringUtils.isBlank(departmentId)) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridDeleteAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridDeleteAfterHandlerImpl.java index 96b4adb..bfd7513 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridDeleteAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridDeleteAfterHandlerImpl.java @@ -5,6 +5,7 @@ import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.map.IGridDeleteAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import ink.wgink.util.string.WStringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -29,9 +30,14 @@ public class GridDeleteAfterHandlerImpl implements IGridDeleteAfterHandler { @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handler(List gridIds) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (gridIds.isEmpty()) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridPointDeleteAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridPointDeleteAfterHandlerImpl.java index 389f24f..8131e6f 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridPointDeleteAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridPointDeleteAfterHandlerImpl.java @@ -5,6 +5,7 @@ import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.map.IGridPointDeleteAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import ink.wgink.util.string.WStringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -25,9 +26,14 @@ import java.util.Map; public class GridPointDeleteAfterHandlerImpl implements IGridPointDeleteAfterHandler { @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(List gridIds) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (gridIds == null || gridIds.isEmpty()) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridPointSaveAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridPointSaveAfterHandlerImpl.java index 43f9fb5..7be39c3 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridPointSaveAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridPointSaveAfterHandlerImpl.java @@ -7,6 +7,7 @@ import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.map.IGridPointSaveAfterHandler; import ink.wgink.module.map.pojo.dtos.grid.GridPointDTO; import ink.wgink.module.map.service.grid.IGridPointService; +import ink.wgink.properties.kafka.KafkaCustomProperties; import ink.wgink.util.UUIDUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -31,9 +32,14 @@ public class GridPointSaveAfterHandlerImpl implements IGridPointSaveAfterHandler private KafkaTemplate kafkaTemplate; @Autowired private IGridPointService gridPointService; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(String gridId) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (StringUtils.isBlank(gridId)) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridRelationDeleteAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridRelationDeleteAfterHandlerImpl.java index 1562ba7..b7a2366 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridRelationDeleteAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridRelationDeleteAfterHandlerImpl.java @@ -5,6 +5,7 @@ import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.map.IGridRelationDeleteAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import ink.wgink.util.string.WStringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -26,9 +27,14 @@ public class GridRelationDeleteAfterHandlerImpl implements IGridRelationDeleteAf @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(List relationIds) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (relationIds.isEmpty()) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridRelationSaveAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridRelationSaveAfterHandlerImpl.java index fb5aa08..79deef1 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridRelationSaveAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridRelationSaveAfterHandlerImpl.java @@ -8,6 +8,7 @@ import ink.wgink.interfaces.map.IGridRelationSaveAfterHandler; import ink.wgink.module.map.pojo.dtos.grid.GridDTO; import ink.wgink.module.map.service.grid.IGridService; import ink.wgink.pojo.dtos.user.UserDTO; +import ink.wgink.properties.kafka.KafkaCustomProperties; import ink.wgink.service.user.service.IUserService; import ink.wgink.util.string.WStringUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -35,9 +36,14 @@ public class GridRelationSaveAfterHandlerImpl implements IGridRelationSaveAfterH private IUserService userService; @Autowired private IGridService gridService; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(List relationIds) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (relationIds.isEmpty()) { return; } @@ -53,6 +59,9 @@ public class GridRelationSaveAfterHandlerImpl implements IGridRelationSaveAfterH @Override public void handle(UserDTO userDTO) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } List gridDTOs = gridService.listByRelationId(userDTO.getUserId()); if (gridDTOs.isEmpty()) { return; diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridSaveAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridSaveAfterHandlerImpl.java index c158802..ef7c789 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridSaveAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridSaveAfterHandlerImpl.java @@ -5,6 +5,7 @@ import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.map.IGridSaveAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -25,9 +26,14 @@ public class GridSaveAfterHandlerImpl implements IGridSaveAfterHandler { @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(String gridId, String gridCode, String gridName, String fillColor, String areaCode, String areaName) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (StringUtils.isBlank(gridId)) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridUpdateAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridUpdateAfterHandlerImpl.java index ecf5454..9f342bd 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridUpdateAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/GridUpdateAfterHandlerImpl.java @@ -5,6 +5,7 @@ import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.map.IGridUpdateAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -28,9 +29,14 @@ public class GridUpdateAfterHandlerImpl implements IGridUpdateAfterHandler { @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(String gridId, String gridName, String fillColor) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (StringUtils.isBlank(gridId)) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserDeleteAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserDeleteAfterHandlerImpl.java index eae260e..ad3aa67 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserDeleteAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserDeleteAfterHandlerImpl.java @@ -6,6 +6,7 @@ import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.role.IRoleUserDeleteAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import ink.wgink.util.string.WStringUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -29,9 +30,14 @@ public class RoleUserDeleteAfterHandlerImpl implements IRoleUserDeleteAfterHandl private KafkaTemplate kafkaTemplate; @Autowired private ParamsConfigProperties paramsConfigProperties; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(String roleId, List userIds) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (StringUtils.isBlank(roleId)) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserSaveAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserSaveAfterHandlerImpl.java index 7358343..86f7c33 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserSaveAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserSaveAfterHandlerImpl.java @@ -8,6 +8,7 @@ import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService; import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.role.IRoleUserSaveAfterHandler; +import ink.wgink.properties.kafka.KafkaCustomProperties; import ink.wgink.service.role.service.IRoleUserService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -36,9 +37,14 @@ public class RoleUserSaveAfterHandlerImpl implements IRoleUserSaveAfterHandler { private IUserExpandService userExpandService; @Autowired private ParamsConfigProperties paramsConfigProperties; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(String roleId, List userIds) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (StringUtils.isBlank(roleId)) { return; } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/UserUpdateAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/UserUpdateAfterHandlerImpl.java index 623c97f..1d809ed 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/UserUpdateAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/UserUpdateAfterHandlerImpl.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; import ink.wgink.exceptions.base.SystemException; import ink.wgink.interfaces.user.IUserUpdateAfterHandler; import ink.wgink.pojo.dtos.user.UserDTO; +import ink.wgink.properties.kafka.KafkaCustomProperties; import ink.wgink.service.user.service.IUserService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -29,9 +30,14 @@ public class UserUpdateAfterHandlerImpl implements IUserUpdateAfterHandler { private KafkaTemplate kafkaTemplate; @Autowired private IUserService userService; + @Autowired + private KafkaCustomProperties kafkaCustomProperties; @Override public void handle(String userId) throws SystemException { + if (!kafkaCustomProperties.getActive()) { + return; + } if (StringUtils.isBlank(userId)) { return; } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 856a2d5..731f020 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -68,6 +68,7 @@ spring: max-idle: 8 min-idle: 0 kafka: + active: false bootstrap-servers: 192.168.0.103:9092 producer: # 写入失败时,重试次数。当leader节点失效,一个repli节点会替代成为leader节点,此时可能出现写入失败, diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index c8ae168..a30da36 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -115,6 +115,13 @@ file: access-key: smartcity secret-key: smartcity +# appToken +app-token: + has-department: false + has-role: true + has-position: false + has-group: false + # 即时通讯 websocket: url: ${server.ip}