diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml index f464722..07e8fb5 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml @@ -825,7 +825,7 @@ diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffMapper.xml index 4de8894..fca92c3 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffMapper.xml +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffMapper.xml @@ -6,17 +6,17 @@ INSERT INTO nakadai.hr_user_info (user_name, unique_identification, email,role_id,school_id,create_time, - update_time,user_avatars) - VALUES (#{userName}, #{uniqueIdentification}, #{email},0,0,now(), now(),#{userAvatars}) + update_time,user_avatars,last_login_time,login_number) + VALUES (#{userName}, #{uniqueIdentification}, #{email},0,0,now(), now(),#{userAvatars},now(),#{loginNumber}) INSERT INTO nakadai.hr_user_account(user_id, account,phone , password, work_number, school_id, platform_id, - type, create_time, update_time,app_open_id) + type, create_time, update_time,app_open_id,platform_bind_time,phone_binding_time) VALUES (#{userId}, #{account},#{phone}, #{password}, #{workNumber}, 0, #{platformId}, #{type}, - now(), now(),#{appOpenId}) + now(), now(),#{appOpenId},now(),now()) diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml index a086877..9ebf1be 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml @@ -410,7 +410,7 @@ WHEN o.order_type = 2 THEN IFNULL( ec.company_name, ua.account ) WHEN o.order_type = 1 THEN - IFNULL( uai.real_name, ua.account ) + IFNULL( uai.real_name, avatars.account ) END) LIKE CONCAT('%', #{orderParam.queryCriteria} ,'%')) diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml index 646f83b..6d4660a 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml @@ -146,7 +146,7 @@ hpa.account_id, a.account, pc.classification_name as teamName, - pc.id as partnerClassificationId, + pc.id as classificationId, pc.is_team, pc.parent_id, pc.create_time as joinTime, diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java index 4e10acf..9ba66a3 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java @@ -26,6 +26,8 @@ public interface PlatformTeamAccountService extends IService data = new HashedMap(); - UserAccount userAccount = baseMapper.selectAccountByOpenId(appletCallbackReq.getOpenId(), appletCallbackReq.getPlatformId()); - //该平台已经注册 - if (userAccount != null){ - data.put("registerId", userAccount.getId()); - data.put("openId", appletCallbackReq.getOpenId()); - return R.ok().put("data",data); - } - if (appletCallbackReq.getPhone()!= null){ - UserAccount userAccountByPhone = baseMapper.selectAccount(appletCallbackReq.getPhone(),appletCallbackReq.getPlatformId().toString()); + ArrayList arrayList = new ArrayList<>(); + arrayList.add("5"); + arrayList.add("6"); + for (String platformId : arrayList) { + UserAccount userAccountByPhone = baseMapper.selectAccount(appletCallbackReq.getPhone(), platformId); //根据手机号查询用户 if (userAccountByPhone != null){ if (!userAccountByPhone.getIsEnable()){ throw new CustomException(ExceptionEnum.ACCOUNT_DISABLED); } - //邀请添加用户没有openid,登录更新openId - baseMapper.updateAccountOpenId(appletCallbackReq.getOpenId(),userAccountByPhone.getId()); - //更新登录时间 - baseMapper.updateUserInfo(userAccountByPhone.getUserId()); - data.put("token", JwtUtils.getJwtToken(userAccountByPhone.getId().toString(),getShopId(appletCallbackReq.getOpenId(),appletCallbackReq.getPlatformId()),appletCallbackReq.getPlatformId())); + if (userAccountByPhone.getAppOpenId().equals("0")){ + data.put("platformId", platformId); + //邀请添加用户没有openid,登录更新openId + baseMapper.updateAccountOpenId(appletCallbackReq.getOpenId(),userAccountByPhone.getId()); + //查询个人端账号更新openid + UserAccount userAccount = baseMapper.selectAccount(appletCallbackReq.getPhone(), "7"); + baseMapper.updateAccountOpenId(appletCallbackReq.getOpenId(),userAccount.getId()); + //更新登录时间 + baseMapper.updateUserInfo(userAccountByPhone.getUserId()); + } + data.put("token", JwtUtils.getJwtToken(userAccountByPhone.getId().toString(),getShopId(appletCallbackReq.getOpenId(),Integer.valueOf(platformId)),Integer.valueOf(platformId))); data.put("openId", appletCallbackReq.getOpenId()); - //TODO 团队信息待处理 -// data.put("teamId",platformTeamClassification.getId()); -// data.put("teamName",teamName); + return R.ok().put("data",data); } } + + return R.ok(); + } + + @Override + public R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq) { + Map data = new HashedMap(); + UserAccount userAccount = baseMapper.selectAccountByOpenId(appletCallbackReq.getOpenId(), appletCallbackReq.getPlatformId()); + //该平台已经注册 + if (userAccount != null){ + data.put("registerId", userAccount.getId()); + data.put("openId", appletCallbackReq.getOpenId()); + return R.ok().put("data",data); + } + String randomNumber5 = cn.hutool.core.util.RandomUtil.randomNumbers(5); String randomNumber6 = cn.hutool.core.util.RandomUtil.randomNumbers(6); String randomNumber7 = cn.hutool.core.util.RandomUtil.randomNumbers(7); @@ -213,9 +230,12 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl(). eq("account_id", userAccount.getId())); - manageId = platformTeamAccount.getManageId(); - //被邀请人有合伙人账号,判断是否已经存在当前团队中 + + //被邀请人有团队账号,判断是否已经存在当前团队中 if (ObjectUtil.isNotNull(platformTeamAccount)){ + manageId = platformTeamAccount.getManageId(); List platformTeamList = platformTeamMapper.selectList(new QueryWrapper(). eq("manage_id", platformTeamAccount.getManageId())); - //查询团队下的成员是否存在团队中 List teamMeb = platformTeamClassificationMapper.selectList(new QueryWrapper(). eq("parent_id", inviteJoinInfo.getClassificationId())); @@ -405,6 +424,51 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl 0) { + PlatformTeam platformTeam = new PlatformTeam(); + platformTeam.setManageId(platformTeamAccount.getManageId()); + platformTeam.setClassificationId(platformTeamMeb.getId()); + platformTeamMapper.insert(platformTeam); + } + return insert > 0 ? R.ok() : R.error(); + //拉入当前团队 + }else { + //添加团队管理账号 + PlatformTeamAccount platformTeamAccount1 = new PlatformTeamAccount(); + platformTeamAccount1.setAccountId(userAccount.getId()); + platformTeamAccount1.setPlatformId(inviteJoinInfo.getPlatformId()); + String username = partnerAccountMapper.selectUsername(inviteJoinInfo.getAccountId()); + platformTeamAccount1.setInvitationAccount(username); + baseMapper.insert(platformTeamAccount1); + + PlatformTeamClassification platformTeamAdmin = platformTeamClassificationMapper.selectById(inviteJoinInfo.getClassificationId()); + //新增团队成员 + PlatformTeamClassification platformTeamMeb = new PlatformTeamClassification(); + platformTeamMeb.setIsTeam(0); + platformTeamMeb.setParentId(inviteJoinInfo.getClassificationId()); + platformTeamMeb.setLevel(platformTeamAdmin.getLevel() + 1); + platformTeamMeb.setClassificationName(platformTeamAdmin.getClassificationName()); + int insert = platformTeamClassificationMapper.insert(platformTeamMeb); + + //团队分类 + if (insert > 0) { + PlatformTeam platformTeam = new PlatformTeam(); + platformTeam.setManageId(platformTeamAccount1.getManageId()); + platformTeam.setClassificationId(platformTeamMeb.getId()); + platformTeamMapper.insert(platformTeam); + } + return insert > 0 ? R.ok() : R.error(); } }else { //不存在创建账号,拉入组织 @@ -412,6 +476,7 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl data =(Map) r.get("data"); Integer registerId =(Integer) data.get("registerId"); diff --git a/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java b/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java index ccd74c2..280a0fe 100644 --- a/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java +++ b/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java @@ -97,6 +97,20 @@ public class HrUserAccountController { return iHrUserAccountService.delUserAccounts(ids); } + + @PostMapping("/deletePrompt") + @ApiOperation(value = "批量删除用户,为企业负责人,则提示:该用户为组织负责人,删除后会同步删除该组织,确定删除?") + public R deletePrompt(@RequestBody List ids) { + String tips = null; + for (String id : ids) { + int team = iHrUserAccountService.selectTeam(id); + if (team > 0){ + tips = "该用户为组织负责人,删除后会同步删除该组织,确定删除?"; + } + } + return R.ok().put("tips",tips); + } + /** * 查看用户系统绑定详情 */ diff --git a/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java b/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java index 3e50719..f1a0b81 100644 --- a/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java +++ b/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java @@ -24,6 +24,12 @@ public class OrganizationInfo { @ApiModelProperty("团队id") private Integer teamId; + @ApiModelProperty("是否团队负责人") + private Integer isTeam; + + @ApiModelProperty("团队父id") + private Integer parentId; + @ApiModelProperty("团队启用禁用") private Integer isEnable; diff --git a/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java b/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java index 7f6e2de..c16c4ab 100644 --- a/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java +++ b/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java @@ -63,4 +63,6 @@ public interface HrUserAccountMapper extends BaseMapper { boolean save(Student student); List selectOrganizationInfo(@Param("openId")String openId); + + int selectTeamByOpenId(String id); } diff --git a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml index 21ebeae..42e2d57 100644 --- a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml +++ b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml @@ -843,13 +843,13 @@ count(u.login_number) as login_number, max(CASE WHEN a.platform_id = 7 THEN u.user_name ELSE NULL END) as user_name, a.work_number, - GROUP_CONCAT(s.platform_name) as platformName, + GROUP_CONCAT( DISTINCT s.platform_name) as platformName, CASE WHEN count(ai.id) > 0 THEN '已认证' ELSE '未认证' END as authentication, CASE - WHEN a.platform_id != 7 AND ta.invitation_account IS NULL THEN '自行注册' + WHEN ta.invitation_account IS NULL THEN '自行注册' WHEN a.platform_id != 7 AND ta.invitation_account IS NOT NULL THEN ta.invitation_account ELSE NULL END as accountSource @@ -1100,30 +1100,74 @@ + diff --git a/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java b/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java index b98be0e..c2fc42c 100644 --- a/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java +++ b/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java @@ -88,4 +88,6 @@ public interface IHrUserAccountService extends IService { UserInfoDetailsRes viewUserDetails(String openId); R updateAvatars(String openId, String url, String userName,String platformId); + + int selectTeam(String id); } diff --git a/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java index bc32263..c296579 100644 --- a/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java +++ b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java @@ -416,7 +416,7 @@ public class HrUserAccountServiceImpl extends ServiceImpl userAccountList = hrUserAccountMapper.selectList(new QueryWrapper() - .eq("app_open_id", openId)); + .eq("app_open_id", openId).orderByDesc("platform_id")); if (userAccountList.size() == 0){ res.setStatus(true); res.setMessage("用户不存在,请先重新登录注册!"); @@ -472,6 +472,11 @@ public class HrUserAccountServiceImpl extends ServiceImpl0 ? R.ok():R.error(); } + @Override + public int selectTeam(String id) { + return baseMapper.selectTeamByOpenId(id); + } + @Override public R oneClickEnableVerification(Integer accountId) {