diff --git a/src/main/java/com/rymcu/forest/handler/AccountHandler.java b/src/main/java/com/rymcu/forest/handler/AccountHandler.java new file mode 100644 index 0000000..96315a5 --- /dev/null +++ b/src/main/java/com/rymcu/forest/handler/AccountHandler.java @@ -0,0 +1,26 @@ +package com.rymcu.forest.handler; + +import com.rymcu.forest.handler.event.AccountEvent; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.event.EventListener; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +/** + * Created on 2022/8/24 14:44. + * + * @author ronger + * @email ronger-x@outlook.com + * @packageName com.rymcu.forest.handler + */ +@Slf4j +@Component +public class AccountHandler { + + @Async + @EventListener + public void processAccountLastLoginEvent(AccountEvent accountEvent) { + + } + +} diff --git a/src/main/java/com/rymcu/forest/handler/CommentHandler.java b/src/main/java/com/rymcu/forest/handler/CommentHandler.java index 906e1fe..b8cab12 100644 --- a/src/main/java/com/rymcu/forest/handler/CommentHandler.java +++ b/src/main/java/com/rymcu/forest/handler/CommentHandler.java @@ -1,12 +1,12 @@ package com.rymcu.forest.handler; +import com.alibaba.fastjson.JSON; import com.rymcu.forest.core.constant.NotificationConstant; import com.rymcu.forest.entity.Comment; import com.rymcu.forest.handler.event.CommentEvent; import com.rymcu.forest.mapper.CommentMapper; import com.rymcu.forest.util.Html2TextUtil; import com.rymcu.forest.util.NotificationUtils; -import com.rymcu.forest.wx.mp.utils.JsonUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Async; @@ -32,7 +32,7 @@ public class CommentHandler { @Async @EventListener public void processCommentCreatedEvent(CommentEvent commentEvent) throws InterruptedException { - log.info(String.format("开始执行评论发布事件:[%s]", JsonUtils.toJson(commentEvent))); + log.info(String.format("开始执行评论发布事件:[%s]", JSON.toJSONString(commentEvent))); String commentContent = commentEvent.getContent(); Integer length = commentContent.length(); if (length > MAX_PREVIEW) { diff --git a/src/main/java/com/rymcu/forest/handler/event/AccountEvent.java b/src/main/java/com/rymcu/forest/handler/event/AccountEvent.java new file mode 100644 index 0000000..dfdc955 --- /dev/null +++ b/src/main/java/com/rymcu/forest/handler/event/AccountEvent.java @@ -0,0 +1,19 @@ +package com.rymcu.forest.handler.event; + +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * Created on 2022/8/24 14:45. + * + * @author ronger + * @email ronger-x@outlook.com + * @packageName com.rymcu.forest.handler.event + */ +@Data +@AllArgsConstructor +public class AccountEvent { + + private String account; + +} diff --git a/src/main/java/com/rymcu/forest/jwt/service/RedisTokenManager.java b/src/main/java/com/rymcu/forest/jwt/service/RedisTokenManager.java index 4387a84..a409a01 100644 --- a/src/main/java/com/rymcu/forest/jwt/service/RedisTokenManager.java +++ b/src/main/java/com/rymcu/forest/jwt/service/RedisTokenManager.java @@ -1,13 +1,14 @@ package com.rymcu.forest.jwt.service; +import com.rymcu.forest.handler.event.AccountEvent; import com.rymcu.forest.jwt.def.JwtConstants; import com.rymcu.forest.jwt.model.TokenModel; -import com.rymcu.forest.service.UserService; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; @@ -27,7 +28,7 @@ public class RedisTokenManager implements TokenManager { @Autowired private StringRedisTemplate redisTemplate; @Resource - private UserService userService; + private ApplicationEventPublisher applicationEventPublisher; /** * 生成TOKEN @@ -62,7 +63,7 @@ public class RedisTokenManager implements TokenManager { String result = redisTemplate.boundValueOps(key.toString()).get(); if (StringUtils.isBlank(result)) { // 更新最后在线时间 - userService.updateLastOnlineTimeByEmail(model.getUsername()); + applicationEventPublisher.publishEvent(new AccountEvent(model.getUsername())); redisTemplate.boundValueOps(key.toString()).set(LocalDateTime.now().toString(), JwtConstants.LAST_ONLINE_EXPIRES_MINUTE, TimeUnit.MINUTES); } return true; diff --git a/src/main/java/com/rymcu/forest/mapper/BankAccountMapper.java b/src/main/java/com/rymcu/forest/mapper/BankAccountMapper.java index 151905b..af451f7 100644 --- a/src/main/java/com/rymcu/forest/mapper/BankAccountMapper.java +++ b/src/main/java/com/rymcu/forest/mapper/BankAccountMapper.java @@ -39,4 +39,11 @@ public interface BankAccountMapper extends Mapper { * @return */ BankAccountDTO selectByBankAccount(@Param("bankAccount") String bankAccount); + + /** + * 查询用户个人银行账户信息 + * @param idUser + * @return + */ + BankAccountDTO findPersonBankAccountByIdUser(@Param("idUser") Long idUser); } diff --git a/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java index c1f3837..b065e2e 100644 --- a/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java @@ -9,10 +9,11 @@ import com.rymcu.forest.entity.BankAccount; import com.rymcu.forest.entity.TransactionRecord; import com.rymcu.forest.enumerate.TransactionCode; import com.rymcu.forest.enumerate.TransactionEnum; +import com.rymcu.forest.mapper.BankAccountMapper; import com.rymcu.forest.mapper.TransactionRecordMapper; -import com.rymcu.forest.service.BankAccountService; import com.rymcu.forest.service.TransactionRecordService; import com.rymcu.forest.util.DateUtil; +import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -32,7 +33,7 @@ public class TransactionRecordServiceImpl extends AbstractService 0) { return true; @@ -154,4 +163,10 @@ public class TransactionRecordServiceImpl extends AbstractService + \ No newline at end of file