|
|
@@ -6,12 +6,14 @@ import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
|
|
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
|
import com.izouma.nineth.TokenHistory;
|
|
|
import com.izouma.nineth.config.Constants;
|
|
|
+import com.izouma.nineth.config.GeneralProperties;
|
|
|
import com.izouma.nineth.domain.Collection;
|
|
|
import com.izouma.nineth.domain.*;
|
|
|
import com.izouma.nineth.dto.*;
|
|
|
import com.izouma.nineth.enums.AuthStatus;
|
|
|
import com.izouma.nineth.enums.AuthorityName;
|
|
|
import com.izouma.nineth.event.AccountCreatedEvent;
|
|
|
+import com.izouma.nineth.event.RegisterEvent;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.*;
|
|
|
import com.izouma.nineth.security.Authority;
|
|
|
@@ -32,6 +34,7 @@ import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
@@ -40,6 +43,7 @@ import org.springframework.core.env.Environment;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -56,24 +60,27 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
@AllArgsConstructor
|
|
|
public class UserService {
|
|
|
- private UserRepo userRepo;
|
|
|
- private WxMaService wxMaService;
|
|
|
- private WxMpService wxMpService;
|
|
|
- private SmsService smsService;
|
|
|
- private StorageService storageService;
|
|
|
- private JwtTokenUtil jwtTokenUtil;
|
|
|
- private FollowService followService;
|
|
|
- private FollowRepo followRepo;
|
|
|
- private IdentityAuthRepo identityAuthRepo;
|
|
|
- private SysConfigService sysConfigService;
|
|
|
- private UserBankCardRepo userBankCardRepo;
|
|
|
- private InviteRepo inviteRepo;
|
|
|
- private NFTService nftService;
|
|
|
- private CacheService cacheService;
|
|
|
- private TokenHistoryRepo tokenHistoryRepo;
|
|
|
- private CollectionRepo collectionRepo;
|
|
|
- private AdapayMerchantService adapayMerchantService;
|
|
|
- private Environment env;
|
|
|
+ private UserRepo userRepo;
|
|
|
+ private WxMaService wxMaService;
|
|
|
+ private WxMpService wxMpService;
|
|
|
+ private SmsService smsService;
|
|
|
+ private StorageService storageService;
|
|
|
+ private JwtTokenUtil jwtTokenUtil;
|
|
|
+ private FollowService followService;
|
|
|
+ private FollowRepo followRepo;
|
|
|
+ private IdentityAuthRepo identityAuthRepo;
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
+ private UserBankCardRepo userBankCardRepo;
|
|
|
+ private InviteRepo inviteRepo;
|
|
|
+ private NFTService nftService;
|
|
|
+ private CacheService cacheService;
|
|
|
+ private TokenHistoryRepo tokenHistoryRepo;
|
|
|
+ private CollectionRepo collectionRepo;
|
|
|
+ private AdapayMerchantService adapayMerchantService;
|
|
|
+ private Environment env;
|
|
|
+ private RocketMQTemplate rocketMQTemplate;
|
|
|
+ private GeneralProperties generalProperties;
|
|
|
+ private RedisTemplate<String, Object> redisTemplate;
|
|
|
|
|
|
public User update(User user) {
|
|
|
if (!SecurityUtils.hasRole(AuthorityName.ROLE_ADMIN)) {
|
|
|
@@ -236,6 +243,16 @@ public class UserService {
|
|
|
return user;
|
|
|
}
|
|
|
|
|
|
+ public String mqRegister(String phone, String code, String password, String inviteCode, Long invitor, Long collectionId) {
|
|
|
+ rocketMQTemplate.convertAndSend(generalProperties.getRegisterTopic(),
|
|
|
+ new RegisterEvent(phone, code, password, inviteCode, invitor, collectionId));
|
|
|
+ return phone;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Object getRegisterResult(String phone) {
|
|
|
+ return redisTemplate.opsForValue().get("register::" + phone);
|
|
|
+ }
|
|
|
+
|
|
|
public User testPhoneRegister() {
|
|
|
String phone = "19" + RandomStringUtils.randomNumeric(11);
|
|
|
String password = "123456";
|