|
|
@ -135,11 +135,13 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq) { |
|
|
|
public R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq) { |
|
|
|
|
|
|
|
Map<String, Object> data = new HashedMap<String, Object>(); |
|
|
|
UserAccount userAccount = baseMapper.selectAccountByOpenId(appletCallbackReq.getOpenId(), appletCallbackReq.getPlatformId()); |
|
|
|
UserAccount userAccount = baseMapper.selectAccountByOpenId(appletCallbackReq.getOpenId(), appletCallbackReq.getPlatformId()); |
|
|
|
if (userAccount != null){ |
|
|
|
if (userAccount != null){ |
|
|
|
return R.error("该用户已存在"); |
|
|
|
data.put("registerId", userAccount.getId()); |
|
|
|
|
|
|
|
data.put("openId", appletCallbackReq.getOpenId()); |
|
|
|
|
|
|
|
return R.ok().put("data",data); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, Object> data = new HashedMap<String, Object>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (appletCallbackReq.getPhone()!= null){ |
|
|
|
if (appletCallbackReq.getPhone()!= null){ |
|
|
|
UserAccount userAccountByPhone = baseMapper.selectAccount(appletCallbackReq.getPhone(),appletCallbackReq.getPlatformId().toString()); |
|
|
|
UserAccount userAccountByPhone = baseMapper.selectAccount(appletCallbackReq.getPhone(),appletCallbackReq.getPlatformId().toString()); |
|
|
@ -202,33 +204,49 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco |
|
|
|
addUserInfo(personalUserName, 7, appletCallbackReq.getOpenId(), appletCallbackReq.getPhone()); |
|
|
|
addUserInfo(personalUserName, 7, appletCallbackReq.getOpenId(), appletCallbackReq.getPhone()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 添加供应商/幼儿园信息
|
|
|
|
PlatformTeamAccount platformTeamAccount1 = baseMapper.selectOne(new QueryWrapper<PlatformTeamAccount>(). |
|
|
|
PlatformTeamAccount platformTeamAccount = new PlatformTeamAccount(); |
|
|
|
eq("account_id", accountId). |
|
|
|
platformTeamAccount.setAccountId(accountId); |
|
|
|
eq("platform_id", appletCallbackReq.getPlatformId())); |
|
|
|
platformTeamAccount.setPlatformId(appletCallbackReq.getPlatformId()); |
|
|
|
|
|
|
|
baseMapper.insert(platformTeamAccount); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 添加所属供应商/幼儿园分类,分类为空直接新增团队
|
|
|
|
|
|
|
|
PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification(); |
|
|
|
|
|
|
|
platformTeamClassification.setIsTeam(1); |
|
|
|
|
|
|
|
platformTeamClassification.setParentId(1); |
|
|
|
|
|
|
|
platformTeamClassification.setLevel(1); |
|
|
|
|
|
|
|
String teamName = ""; |
|
|
|
String teamName = ""; |
|
|
|
if (StringUtils.isNotBlank(appletCallbackReq.getOrganizationName())){ |
|
|
|
Integer classificationId = null; |
|
|
|
teamName = appletCallbackReq.getOrganizationName(); |
|
|
|
if (platformTeamAccount1 == null){ |
|
|
|
}else { |
|
|
|
// 添加供应商/幼儿园信息
|
|
|
|
teamName = userName + "的团队"; |
|
|
|
PlatformTeamAccount platformTeamAccount = new PlatformTeamAccount(); |
|
|
|
} |
|
|
|
platformTeamAccount.setAccountId(accountId); |
|
|
|
|
|
|
|
platformTeamAccount.setPlatformId(appletCallbackReq.getPlatformId()); |
|
|
|
|
|
|
|
baseMapper.insert(platformTeamAccount); |
|
|
|
|
|
|
|
|
|
|
|
platformTeamClassification.setClassificationName(teamName); |
|
|
|
// 添加所属供应商/幼儿园分类,分类为空直接新增团队
|
|
|
|
int insert = platformTeamClassificationMapper.insert(platformTeamClassification); |
|
|
|
PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification(); |
|
|
|
if (insert > 0) { |
|
|
|
platformTeamClassification.setIsTeam(1); |
|
|
|
PlatformTeam platformTeam = new PlatformTeam(); |
|
|
|
platformTeamClassification.setParentId(1); |
|
|
|
platformTeam.setManageId(platformTeamAccount.getManageId()); |
|
|
|
platformTeamClassification.setLevel(1); |
|
|
|
platformTeam.setClassificationId(platformTeamClassification.getId()); |
|
|
|
|
|
|
|
platformTeamMapper.insert(platformTeam); |
|
|
|
if (StringUtils.isNotBlank(appletCallbackReq.getOrganizationName())){ |
|
|
|
|
|
|
|
teamName = appletCallbackReq.getOrganizationName(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
teamName = userName + "的团队"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
classificationId = platformTeamClassification.getId(); |
|
|
|
|
|
|
|
platformTeamClassification.setClassificationName(teamName); |
|
|
|
|
|
|
|
int insert = platformTeamClassificationMapper.insert(platformTeamClassification); |
|
|
|
|
|
|
|
if (insert > 0) { |
|
|
|
|
|
|
|
PlatformTeam platformTeam = new PlatformTeam(); |
|
|
|
|
|
|
|
platformTeam.setManageId(platformTeamAccount.getManageId()); |
|
|
|
|
|
|
|
platformTeam.setClassificationId(platformTeamClassification.getId()); |
|
|
|
|
|
|
|
platformTeamMapper.insert(platformTeam); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
List<PlatformTeam> platformTeamList = platformTeamMapper.selectList(new QueryWrapper<PlatformTeam>() |
|
|
|
|
|
|
|
.eq("manage_id", platformTeamAccount1.getManageId())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlatformTeamClassification platformTeamClassification = platformTeamClassificationMapper.selectOne(new QueryWrapper<PlatformTeamClassification>(). |
|
|
|
|
|
|
|
eq("is_team", 1). |
|
|
|
|
|
|
|
in("id", platformTeamList.stream().map(PlatformTeam::getClassificationId).collect(Collectors.toList()))); |
|
|
|
|
|
|
|
classificationId = platformTeamClassification.getId(); |
|
|
|
|
|
|
|
teamName = platformTeamClassification.getClassificationName(); |
|
|
|
} |
|
|
|
} |
|
|
|
data.put("teamId",platformTeamClassification.getId()); |
|
|
|
data.put("teamId",classificationId); |
|
|
|
data.put("teamName",teamName); |
|
|
|
data.put("teamName",teamName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -265,7 +283,12 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco |
|
|
|
public R getTeamsByPlatformId(String accountId, Integer platformId) { |
|
|
|
public R getTeamsByPlatformId(String accountId, Integer platformId) { |
|
|
|
List<TeamAccountResp> teamsByPlatformId = baseMapper.getTeamsByPlatformId(accountId,platformId); |
|
|
|
List<TeamAccountResp> teamsByPlatformId = baseMapper.getTeamsByPlatformId(accountId,platformId); |
|
|
|
teamsByPlatformId.forEach(teamAccountResp -> { |
|
|
|
teamsByPlatformId.forEach(teamAccountResp -> { |
|
|
|
PlatformTeamClassification platformTeamClassification = platformTeamClassificationMapper.getParentInformationBasedOnChild(teamAccountResp.getClassificationId()); |
|
|
|
PlatformTeamClassification platformTeamClassification; |
|
|
|
|
|
|
|
if (teamAccountResp.getIsTeam().equals("0")){ |
|
|
|
|
|
|
|
platformTeamClassification = platformTeamClassificationMapper.getParentInformationBasedOnChild(teamAccountResp.getClassificationId()); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
platformTeamClassification = platformTeamClassificationMapper.selectById(teamAccountResp.getClassificationId()); |
|
|
|
|
|
|
|
} |
|
|
|
teamAccountResp.setPlatformTeamClassificationList(platformTeamClassification); |
|
|
|
teamAccountResp.setPlatformTeamClassificationList(platformTeamClassification); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return R.ok().put("data", teamsByPlatformId); |
|
|
|
return R.ok().put("data", teamsByPlatformId); |
|
|
|