From c4b6e0de4e8cd23134e0b1bfa819437208250ae5 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Wed, 20 Dec 2023 16:02:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=B7=BB=E5=8A=A0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E7=AB=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PlatformTeamAccountServiceImpl.java | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java index 1445d4e..115dfe6 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java @@ -124,65 +124,45 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl data = new HashedMap(); String randomNumbers = cn.hutool.core.util.RandomUtil.randomNumbers(6); - String accountId = null; + Integer accountId ; String userName = ""; - String accountName = ""; // 根据不同的平台ID设置用户名和账户名 switch (appletCallbackReq.getPlatformId()) { case 5: if (StringUtils.isNotBlank(appletCallbackReq.getOrganizationName())){ userName = appletCallbackReq.getOrganizationName(); - accountName = appletCallbackReq.getOrganizationName(); }else { userName = "幼儿园" + randomNumbers; - accountName = "幼儿园" + randomNumbers; } break; case 6: if (StringUtils.isNotBlank(appletCallbackReq.getOrganizationName())){ userName = appletCallbackReq.getOrganizationName(); - accountName = appletCallbackReq.getOrganizationName(); }else { userName = "供应商" + randomNumbers; - accountName = "供应商" + randomNumbers; } break; case 7: userName = "个人" + randomNumbers; - accountName = "个人" + randomNumbers; break; } - // 创建并设置用户信息 - UserInfo userInfo = new UserInfo(); - userInfo.setUserName(userName); - userInfo.setLoginNumber(1); - userInfo.setLastLoginTime(new Date()); - staffMapper.addUserInfo(userInfo); - - // 创建并设置用户账户 - UserAccount userAccount = new UserAccount(); - userAccount.setPhone(appletCallbackReq.getPhone()); - userAccount.setPhoneBindingTime(new Date()); - userAccount.setPassword(MD5.encrypt("1122aa")); - userAccount.setUserId(userInfo.getUserId()); - userAccount.setType(2); // 平台端区分:0->教师端 1->学生端 2->无端 - userAccount.setPlatformId(appletCallbackReq.getPlatformId().toString()); - userAccount.setAppOpenId(appletCallbackReq.getOpenId()); - userAccount.setAccount(accountName); - staffMapper.addUserAccount(userAccount); - accountId = userAccount.getId().toString(); + accountId = addUserInfo(userName, appletCallbackReq.getPlatformId(), appletCallbackReq.getOpenId(), appletCallbackReq.getPhone()); - // 如果平台ID不是7,添加供应商信息和团队信息 + // 如果平台ID不是7,添加供应商/幼儿园信息和团队信息,默认添加个人端信息 if (appletCallbackReq.getPlatformId() != 7) { - // 添加供应商信息 + //添加个人端信息 + String personalUserName = "个人" + randomNumbers; + addUserInfo(personalUserName, 7, appletCallbackReq.getOpenId(), appletCallbackReq.getPhone()); + + // 添加供应商/幼儿园信息 PlatformTeamAccount platformTeamAccount = new PlatformTeamAccount(); - platformTeamAccount.setAccountId(userAccount.getId()); + platformTeamAccount.setAccountId(accountId); platformTeamAccount.setPlatformId(appletCallbackReq.getPlatformId()); baseMapper.insert(platformTeamAccount); - // 添加所属供应商分类,分类为空直接新增团队 + // 添加所属供应商/幼儿园分类,分类为空直接新增团队 PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification(); platformTeamClassification.setIsTeam(1); platformTeamClassification.setParentId(1); @@ -191,7 +171,7 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl教师端 1->学生端 2->无端 + userAccount.setPlatformId(platformId.toString()); + userAccount.setAppOpenId(openId); + userAccount.setAccount(userName); + staffMapper.addUserAccount(userAccount); + return userAccount.getId(); + } + @Override public R getTeamsByPlatformId(String accountId, Integer platformId) { List teamsByPlatformId = baseMapper.getTeamsByPlatformId(accountId,platformId);