|
|
@@ -1,10 +1,13 @@
|
|
|
package com.izouma.nineth.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alipay.api.AlipayApiException;
|
|
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
|
import com.izouma.nineth.ApplicationTests;
|
|
|
import com.izouma.nineth.config.Constants;
|
|
|
import com.izouma.nineth.domain.IdentityAuth;
|
|
|
+import com.izouma.nineth.domain.netease.NeteaseMessage;
|
|
|
+import com.izouma.nineth.domain.netease.Team;
|
|
|
import com.izouma.nineth.domain.User;
|
|
|
import com.izouma.nineth.dto.BankValidate;
|
|
|
import com.izouma.nineth.dto.PageQuery;
|
|
|
@@ -12,10 +15,13 @@ import com.izouma.nineth.dto.UserBankCard;
|
|
|
import com.izouma.nineth.dto.UserRegister;
|
|
|
import com.izouma.nineth.enums.AuthStatus;
|
|
|
import com.izouma.nineth.enums.InviteType;
|
|
|
+import com.izouma.nineth.enums.netease.TeamType;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.IdentityAuthRepo;
|
|
|
import com.izouma.nineth.repo.UserBankCardRepo;
|
|
|
import com.izouma.nineth.repo.UserRepo;
|
|
|
+import com.izouma.nineth.service.netease.NeteaseMessageService;
|
|
|
+import com.izouma.nineth.service.netease.TeamService;
|
|
|
import com.izouma.nineth.service.storage.StorageService;
|
|
|
import com.izouma.nineth.utils.BankUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -24,6 +30,8 @@ import org.junit.jupiter.api.Test;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.regex.Pattern;
|
|
|
@@ -49,6 +57,10 @@ public class UserServiceTest extends ApplicationTests {
|
|
|
private AdapayMerchantService adapayMerchantService;
|
|
|
@Autowired
|
|
|
private IdentityAuthRepo identityAuthRepo;
|
|
|
+ @Autowired
|
|
|
+ private TeamService teamService;
|
|
|
+ @Autowired
|
|
|
+ private NeteaseMessageService neteaseMessageService;
|
|
|
|
|
|
@Test
|
|
|
public void findByUsernameAndDelFalse1() {
|
|
|
@@ -139,7 +151,8 @@ public class UserServiceTest extends ApplicationTests {
|
|
|
String bankNo = "6222024301070380165";
|
|
|
String phone = "15077886171";
|
|
|
User user = userRepo.findById(userId).orElseThrow(new BusinessException("用户不存在"));
|
|
|
- IdentityAuth identityAuth = identityAuthRepo.findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(userId, AuthStatus.SUCCESS)
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(userId, AuthStatus.SUCCESS)
|
|
|
.orElseThrow(new BusinessException("用户未认证"));
|
|
|
if (identityAuth.isOrg()) {
|
|
|
//throw new BusinessException("企业认证用户请绑定对公账户");
|
|
|
@@ -152,7 +165,9 @@ public class UserServiceTest extends ApplicationTests {
|
|
|
throw new BusinessException("暂不支持此卡");
|
|
|
}
|
|
|
|
|
|
- adapayMerchantService.createMemberForAll(userId.toString(), user.getPhone(), identityAuth.getRealName(), identityAuth.getIdNo());
|
|
|
+ adapayMerchantService
|
|
|
+ .createMemberForAll(userId.toString(), user.getPhone(), identityAuth.getRealName(), identityAuth
|
|
|
+ .getIdNo());
|
|
|
user.setMemberId(user.getId().toString());
|
|
|
userRepo.save(user);
|
|
|
|
|
|
@@ -217,4 +232,29 @@ public class UserServiceTest extends ApplicationTests {
|
|
|
public void checkauth() throws AlipayApiException {
|
|
|
userService.checkFaceAuth("7160e6a875cb67648bc7a3cce6e5397e");
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void teamTest() {
|
|
|
+ Team team = new Team();
|
|
|
+ team.setName("测试大厅2");
|
|
|
+ team.setOwnerid("9859");
|
|
|
+ List<String> members = new ArrayList<>();
|
|
|
+ members.add("7956591");
|
|
|
+ team.setMembers(members);
|
|
|
+ team.setCustom(TeamType.PUBLIC);
|
|
|
+ teamService.create(team);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void sendMessage() {
|
|
|
+ NeteaseMessage neteaseMessage = new NeteaseMessage();
|
|
|
+ neteaseMessage.setFromId("9859");
|
|
|
+ neteaseMessage.setToId("9850");
|
|
|
+ neteaseMessage.setOpe(0);
|
|
|
+ neteaseMessage.setType(0);
|
|
|
+ Map<String, Object> body = new HashMap<>();
|
|
|
+ body.put("msg", "这是一条测试消息");
|
|
|
+ neteaseMessage.setBody(JSONObject.toJSONString(body));
|
|
|
+ neteaseMessageService.sendMessage(neteaseMessage);
|
|
|
+ }
|
|
|
}
|