|
@@ -181,6 +181,10 @@ public class LoginServiceImpl implements LoginService {
|
|
}
|
|
}
|
|
//处理比对密码
|
|
//处理比对密码
|
|
UserLoginVo baseUser = loginMapper.getLoginOrganizeUserByMobileOrEmail(mobileOrEmail);
|
|
UserLoginVo baseUser = loginMapper.getLoginOrganizeUserByMobileOrEmail(mobileOrEmail);
|
|
|
|
+ // 机构下线,登录失败
|
|
|
|
+ if (91 == baseUser.getClubStatus()) {
|
|
|
|
+ return ResponseJson.error(-1,"您的企业账号已被冻结,请联系客服处理", null);
|
|
|
|
+ }
|
|
if (null != baseUser) {
|
|
if (null != baseUser) {
|
|
// 绑定微信信息
|
|
// 绑定微信信息
|
|
Integer operationUser = loginMapper.getOperationUser(mobileOrEmail);
|
|
Integer operationUser = loginMapper.getOperationUser(mobileOrEmail);
|
|
@@ -192,8 +196,8 @@ public class LoginServiceImpl implements LoginService {
|
|
operationVo.setUserType(1);
|
|
operationVo.setUserType(1);
|
|
operationVo.setUserId(baseUser.getUserId());
|
|
operationVo.setUserId(baseUser.getUserId());
|
|
operationVo.setClubId(baseUser.getClubId());
|
|
operationVo.setClubId(baseUser.getClubId());
|
|
- operationVo.setMobile(baseUser.getMobile());
|
|
|
|
- operationVo.setLinkName(baseUser.getUserName());
|
|
|
|
|
|
+ operationVo.setMobile(baseUser.getBindMobile());
|
|
|
|
+ operationVo.setLinkName(baseUser.getClubLinkMan());
|
|
operationVo.setStatus(2);
|
|
operationVo.setStatus(2);
|
|
operationVo.setUnionId(unionId);
|
|
operationVo.setUnionId(unionId);
|
|
operationVo.setBindTime(new Date());
|
|
operationVo.setBindTime(new Date());
|
|
@@ -359,7 +363,7 @@ public class LoginServiceImpl implements LoginService {
|
|
operationVo.setUserType(1);
|
|
operationVo.setUserType(1);
|
|
operationVo.setUserId(baseUser.getUserId());
|
|
operationVo.setUserId(baseUser.getUserId());
|
|
operationVo.setClubId(baseUser.getClubId());
|
|
operationVo.setClubId(baseUser.getClubId());
|
|
- operationVo.setMobile(baseUser.getMobile());
|
|
|
|
|
|
+ operationVo.setMobile(baseUser.getBindMobile());
|
|
operationVo.setLinkName(baseUser.getUserName());
|
|
operationVo.setLinkName(baseUser.getUserName());
|
|
operationVo.setStatus(2);
|
|
operationVo.setStatus(2);
|
|
operationVo.setUnionId(unionId);
|
|
operationVo.setUnionId(unionId);
|
|
@@ -367,7 +371,6 @@ public class LoginServiceImpl implements LoginService {
|
|
operationVo.setAddTime(new Date());
|
|
operationVo.setAddTime(new Date());
|
|
operationVo.setDelFlag(0);
|
|
operationVo.setDelFlag(0);
|
|
loginMapper.insertOperation(operationVo);
|
|
loginMapper.insertOperation(operationVo);
|
|
- log.info("operationVo***"+operationVo);
|
|
|
|
}
|
|
}
|
|
// 如果前端传入unionId,则存入返回前端
|
|
// 如果前端传入unionId,则存入返回前端
|
|
baseUser.setUnionId(unionId);
|
|
baseUser.setUnionId(unionId);
|
|
@@ -438,7 +441,7 @@ public class LoginServiceImpl implements LoginService {
|
|
redisService.setMap("wxInfo:applets:" + unionId, infoData);
|
|
redisService.setMap("wxInfo:applets:" + unionId, infoData);
|
|
log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId);
|
|
log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId);
|
|
// 协销授权登录
|
|
// 协销授权登录
|
|
- UserLoginVo seller = loginMapper.getServiceProviderUserByOpenId(openId);
|
|
|
|
|
|
+ UserLoginVo seller = loginMapper.getServiceProviderUserByOpenId(openId, 0);
|
|
if (null != seller) {
|
|
if (null != seller) {
|
|
loginMapper.updateServiceProviderUnionId(seller.getUserId(), unionId);
|
|
loginMapper.updateServiceProviderUnionId(seller.getUserId(), unionId);
|
|
String token = JwtUtil.createToken(seller.getUserId());
|
|
String token = JwtUtil.createToken(seller.getUserId());
|
|
@@ -497,13 +500,24 @@ public class LoginServiceImpl implements LoginService {
|
|
}
|
|
}
|
|
// 用户数据存入Redis,key前缀:wxInfo:applets:
|
|
// 用户数据存入Redis,key前缀:wxInfo:applets:
|
|
redisService.setMap("wxInfo:applets:" + unionId, infoData);
|
|
redisService.setMap("wxInfo:applets:" + unionId, infoData);
|
|
- log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId);
|
|
|
|
- /*UserLoginVo userLoginVo = loginMapper.organizeUserInfo(openId);
|
|
|
|
- if (userLoginVo == null) {
|
|
|
|
- userLoginVo = new UserLoginVo();
|
|
|
|
- userLoginVo.setOpenId(openId);
|
|
|
|
- return ResponseJson.error(-2, "用户未注册", userLoginVo);
|
|
|
|
- }*/
|
|
|
|
|
|
+ log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId + "operId" + openId);
|
|
|
|
+ // 采购员授权登录
|
|
|
|
+ UserLoginVo seller = loginMapper.getServiceProviderUserByOpenId(openId, 4);
|
|
|
|
+ if (null != seller) {
|
|
|
|
+ loginMapper.updateServiceProviderUnionId(seller.getUserId(), unionId);
|
|
|
|
+ String token = JwtUtil.createToken(seller.getUserId());
|
|
|
|
+ seller.setToken(token);
|
|
|
|
+ seller.setUnionId(unionId);
|
|
|
|
+ seller.setOpenId(openId);
|
|
|
|
+ // 生成token给协销用户
|
|
|
|
+ String sellerToken = JwtUtil.createToken(seller.getUserId());
|
|
|
|
+ // 为了过期续签,将token存入redis,并设置超时时间
|
|
|
|
+ redisService.set(sellerToken, sellerToken, JwtUtil.getExpireTime());
|
|
|
|
+ seller.setToken(sellerToken);
|
|
|
|
+ seller.setManager(sellerMapper.findManagerByUser(seller.getUserId()));
|
|
|
|
+ seller.setLeaderId(sellerMapper.findLeaderId(seller.getUserId()));
|
|
|
|
+ return ResponseJson.success(seller);
|
|
|
|
+ }
|
|
return organizeOperationAuthLogin(openId, unionId, "mini");
|
|
return organizeOperationAuthLogin(openId, unionId, "mini");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -792,16 +806,16 @@ public class LoginServiceImpl implements LoginService {
|
|
loginUser.setToken(token);
|
|
loginUser.setToken(token);
|
|
if (null != loginUser.getClubStatus() && 91 == loginUser.getClubStatus()) {
|
|
if (null != loginUser.getClubStatus() && 91 == loginUser.getClubStatus()) {
|
|
//机构
|
|
//机构
|
|
- return ResponseJson.error(-2, "您的企业账号已被冻结,请联系客服处理", null);
|
|
|
|
|
|
+ return ResponseJson.error(-1, "您的企业账号已被冻结,请联系客服处理", loginUser);
|
|
}
|
|
}
|
|
// 供应商
|
|
// 供应商
|
|
if (null != loginUser.getShopStatus() && null != loginUser.getUserIdentity() && 3 == loginUser.getUserIdentity()) {
|
|
if (null != loginUser.getShopStatus() && null != loginUser.getUserIdentity() && 3 == loginUser.getUserIdentity()) {
|
|
|
|
|
|
if (3 == loginUser.getShopStatus()) {
|
|
if (3 == loginUser.getShopStatus()) {
|
|
- return ResponseJson.error(-2, "您的企业账号正在加速审核中,审核通过后即可登录", null);
|
|
|
|
|
|
+ return ResponseJson.error(-1, "您的企业账号正在加速审核中,审核通过后即可登录", loginUser);
|
|
}
|
|
}
|
|
if (91 == loginUser.getShopStatus()) {
|
|
if (91 == loginUser.getShopStatus()) {
|
|
- return ResponseJson.error(-2, "您的企业账号已被冻结,请联系客服处理", null);
|
|
|
|
|
|
+ return ResponseJson.error(-1, "您的企业账号已被冻结,请联系客服处理", loginUser);
|
|
}
|
|
}
|
|
if (92 == loginUser.getShopStatus()) {
|
|
if (92 == loginUser.getShopStatus()) {
|
|
return ResponseJson.error(-3, "您的企业账号审核未通过", loginUser);
|
|
return ResponseJson.error(-3, "您的企业账号审核未通过", loginUser);
|
|
@@ -1104,7 +1118,7 @@ public class LoginServiceImpl implements LoginService {
|
|
if (StringUtils.isBlank(invitationCode)) {
|
|
if (StringUtils.isBlank(invitationCode)) {
|
|
return ResponseJson.error("邀请码不能为空", null);
|
|
return ResponseJson.error("邀请码不能为空", null);
|
|
}
|
|
}
|
|
- UserLoginVo operation = loginMapper.getOperationUserByInvitationCode(invitationCode);
|
|
|
|
|
|
+ UserLoginVo operation = loginMapper.getOperationUserByInvitationCode(invitationCode, 0);
|
|
if (operation == null) {
|
|
if (operation == null) {
|
|
return ResponseJson.error("邀请码错误", null);
|
|
return ResponseJson.error("邀请码错误", null);
|
|
}
|
|
}
|
|
@@ -1113,7 +1127,7 @@ public class LoginServiceImpl implements LoginService {
|
|
calendar.setTime(operation.getInvitationCodeTime());
|
|
calendar.setTime(operation.getInvitationCodeTime());
|
|
calendar.add(Calendar.DATE, validTime);
|
|
calendar.add(Calendar.DATE, validTime);
|
|
if (1 == operation.getOperationStatus() && date.getTime() > calendar.getTime().getTime() && 0 == operation.getDelFlag()) {
|
|
if (1 == operation.getOperationStatus() && date.getTime() > calendar.getTime().getTime() && 0 == operation.getDelFlag()) {
|
|
- return ResponseJson.error("邀请码已失效", null);
|
|
|
|
|
|
+ return ResponseJson.error("邀请码已过期,请联系邀请人更新邀请码", null);
|
|
}
|
|
}
|
|
if (2 == operation.getOperationStatus() && 0 == operation.getDelFlag()) {
|
|
if (2 == operation.getOperationStatus() && 0 == operation.getDelFlag()) {
|
|
return ResponseJson.error("邀请码已被使用", null);
|
|
return ResponseJson.error("邀请码已被使用", null);
|
|
@@ -1121,10 +1135,10 @@ public class LoginServiceImpl implements LoginService {
|
|
// 用户身份:1机构,2供应商
|
|
// 用户身份:1机构,2供应商
|
|
int userIdentity = 3 == operation.getUserIdentity() ? 2 : 1;
|
|
int userIdentity = 3 == operation.getUserIdentity() ? 2 : 1;
|
|
if (1 == userIdentity && operation.getClubStatus() != null && 91 == operation.getClubStatus()) {
|
|
if (1 == userIdentity && operation.getClubStatus() != null && 91 == operation.getClubStatus()) {
|
|
- return ResponseJson.error("您的机构已冻结", null);
|
|
|
|
|
|
+ return ResponseJson.error("您的机构已下线", null);
|
|
}
|
|
}
|
|
if (2 == userIdentity && operation.getShopStatus() != null && 91 == operation.getShopStatus()) {
|
|
if (2 == userIdentity && operation.getShopStatus() != null && 91 == operation.getShopStatus()) {
|
|
- return ResponseJson.error("您的企业账号已被冻结,请联系客服处理", null);
|
|
|
|
|
|
+ return ResponseJson.error("您的企业账号已下线,请联系客服处理", null);
|
|
}
|
|
}
|
|
if (0 != operation.getDelFlag()) {
|
|
if (0 != operation.getDelFlag()) {
|
|
return ResponseJson.error("您的邀请码已被删除,请重新添加运营人员", null);
|
|
return ResponseJson.error("您的邀请码已被删除,请重新添加运营人员", null);
|
|
@@ -1142,87 +1156,164 @@ public class LoginServiceImpl implements LoginService {
|
|
operationPo.setAvatarUrl(avatarUrl);
|
|
operationPo.setAvatarUrl(avatarUrl);
|
|
// 绑定状态,1未绑定,2已绑定
|
|
// 绑定状态,1未绑定,2已绑定
|
|
operationPo.setStatus(2);
|
|
operationPo.setStatus(2);
|
|
|
|
+ // 采美进行消息推送
|
|
|
|
+ if (0 == operation.getOrganizeId()) {
|
|
|
|
+ if (1 == userIdentity) {
|
|
|
|
+ // 机构Id
|
|
|
|
+ operationPo.setClubId(operation.getClubId());
|
|
|
|
+ // 用户类型
|
|
|
|
+ operationPo.setUserType(1);
|
|
|
|
+
|
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ String current = dateFormat.format(new Date());
|
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+ messageCenter.setShopId(null);
|
|
|
|
+ messageCenter.setClubId(operation.getClubId());
|
|
|
|
+ messageCenter.setUserType(1);
|
|
|
|
+ messageCenter.setMessageType(2);
|
|
|
|
+ messageCenter.setAccountType(7);
|
|
|
|
+ messageCenter.setContent(nickName);
|
|
|
|
+ messageCenter.setTime(current);
|
|
|
|
+ messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
|
+ //发短信
|
|
|
|
+ String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
|
|
|
|
+ String mobile = messageCenterMapper.contractMobile(operation.getClubId());
|
|
|
|
+ if (mobile != null && mobile != "") {
|
|
|
|
+ remoteCallService.remoteSendSms(2, 3, mobile, message);
|
|
|
|
+ }
|
|
|
|
|
|
- if (1 == userIdentity) {
|
|
|
|
- // 机构Id
|
|
|
|
- operationPo.setClubId(operation.getClubId());
|
|
|
|
- // 用户类型
|
|
|
|
- operationPo.setUserType(1);
|
|
|
|
-
|
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
- String current = dateFormat.format(new Date());
|
|
|
|
- MessageCenter messageCenter = new MessageCenter();
|
|
|
|
- messageCenter.setShopId(null);
|
|
|
|
- messageCenter.setClubId(operation.getClubId());
|
|
|
|
- messageCenter.setUserType(1);
|
|
|
|
- messageCenter.setMessageType(2);
|
|
|
|
- messageCenter.setAccountType(7);
|
|
|
|
- messageCenter.setContent(nickName);
|
|
|
|
- messageCenter.setTime(current);
|
|
|
|
- messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
|
- //发短信
|
|
|
|
- String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
|
|
|
|
- String mobile = messageCenterMapper.contractMobile(operation.getClubId());
|
|
|
|
- if (mobile != null && mobile != "") {
|
|
|
|
- remoteCallService.remoteSendSms(2, 3, mobile, message);
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ log.info("***********机构通过邀请码登入微信公众号推送************");
|
|
|
|
+ String accessToken = weChatService.getAccessToken();
|
|
|
|
+ String openid = messageCenterMapper.getOpenidListByPermission(unionId);
|
|
|
|
+ String time = current;
|
|
|
|
+ String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
|
|
|
|
+ // 跳转到【小程序付款-选择支付方式页面】
|
|
|
|
+ String pagePath = "https://www.caimei365.com/";
|
|
|
|
+ // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
|
|
|
|
+ log.error("获取openid>>>>>" + openid);
|
|
|
|
+ weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("【机构通过邀请码登入通知】获取微信公众号access_token异常!", e);
|
|
|
|
+ }
|
|
|
|
|
|
- try {
|
|
|
|
- log.info("***********机构通过邀请码登入微信公众号推送************");
|
|
|
|
- String accessToken = weChatService.getAccessToken();
|
|
|
|
- String openid = messageCenterMapper.getOpenidListByPermission(unionId);
|
|
|
|
- String time = current;
|
|
|
|
- String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
|
|
|
|
- // 跳转到【小程序付款-选择支付方式页面】
|
|
|
|
- String pagePath = "https://www.caimei365.com/";
|
|
|
|
- // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
|
|
|
|
- log.error("获取openid>>>>>" + openid);
|
|
|
|
- weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("【机构通过邀请码登入通知】获取微信公众号access_token异常!", e);
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ } else {
|
|
|
|
+ // 供应商Id
|
|
|
|
+ operationPo.setShopId(operation.getShopId());
|
|
|
|
+ // 用户类型
|
|
|
|
+ operationPo.setUserType(2);
|
|
|
|
+
|
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ String current = dateFormat.format(new Date());
|
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+ messageCenter.setShopId(operation.getShopId());
|
|
|
|
+ messageCenter.setClubId(null);
|
|
|
|
+ messageCenter.setUserType(2);
|
|
|
|
+ messageCenter.setMessageType(2);
|
|
|
|
+ messageCenter.setShopMessType(2);
|
|
|
|
+ messageCenter.setContent(nickName);
|
|
|
|
+ messageCenter.setTime(current);
|
|
|
|
+ messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
|
+
|
|
|
|
+ //发短信
|
|
|
|
+ String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
|
|
|
|
+ String mobile = messageCenterMapper.contractMobiles(operation.getShopId());
|
|
|
|
+ if (mobile != null && mobile != "") {
|
|
|
|
+ remoteCallService.remoteSendSms(2, 3, mobile, message);
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ log.info("***********供应商通过邀请码登入微信公众号推送************");
|
|
|
|
+ String accessToken = weChatService.getAccessToken();
|
|
|
|
+ String openid = messageCenterMapper.getOpenidListByPermission(unionId);
|
|
|
|
+ String time = current;
|
|
|
|
+ String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
|
|
|
|
+ // 跳转到【小程序付款-选择支付方式页面】
|
|
|
|
+ String pagePath = "https://www.caimei365.com/";
|
|
|
|
+ // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
|
|
|
|
+ log.error("获取openid>>>>>" + openid);
|
|
|
|
+ weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("【供应商通过邀请码登入通知】获取微信公众号access_token异常!", e);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- // 供应商Id
|
|
|
|
- operationPo.setShopId(operation.getShopId());
|
|
|
|
|
|
+ // 机构Id
|
|
|
|
+ operationPo.setClubId(operation.getClubId());
|
|
// 用户类型
|
|
// 用户类型
|
|
- operationPo.setUserType(2);
|
|
|
|
-
|
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
- String current = dateFormat.format(new Date());
|
|
|
|
- MessageCenter messageCenter = new MessageCenter();
|
|
|
|
- messageCenter.setShopId(operation.getShopId());
|
|
|
|
- messageCenter.setClubId(null);
|
|
|
|
- messageCenter.setUserType(2);
|
|
|
|
- messageCenter.setMessageType(2);
|
|
|
|
- messageCenter.setShopMessType(2);
|
|
|
|
- messageCenter.setContent(nickName);
|
|
|
|
- messageCenter.setTime(current);
|
|
|
|
- messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
|
-
|
|
|
|
- //发短信
|
|
|
|
- String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
|
|
|
|
- String mobile = messageCenterMapper.contractMobiles(operation.getShopId());
|
|
|
|
- if (mobile != null && mobile != "") {
|
|
|
|
- remoteCallService.remoteSendSms(2, 3, mobile, message);
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- log.info("***********供应商通过邀请码登入微信公众号推送************");
|
|
|
|
- String accessToken = weChatService.getAccessToken();
|
|
|
|
- String openid = messageCenterMapper.getOpenidListByPermission(unionId);
|
|
|
|
- String time = current;
|
|
|
|
- String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
|
|
|
|
- // 跳转到【小程序付款-选择支付方式页面】
|
|
|
|
- String pagePath = "https://www.caimei365.com/";
|
|
|
|
- // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
|
|
|
|
- log.error("获取openid>>>>>" + openid);
|
|
|
|
- weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("【供应商通过邀请码登入通知】获取微信公众号access_token异常!", e);
|
|
|
|
- }
|
|
|
|
|
|
+ operationPo.setUserType(1);
|
|
|
|
+ }
|
|
|
|
+ operationPo.setUpdateTime(new Date());
|
|
|
|
+ operationPo.setBindTime(new Date());
|
|
|
|
+ // 更新运营人员信息
|
|
|
|
+ operationMapper.updateOperationByInvitation(operationPo);
|
|
|
|
+ // 返回登录校验结果
|
|
|
|
+ return logonVerify(operation);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 邀请码登录
|
|
|
|
+ *
|
|
|
|
+ * @param invitationCode 邀请码
|
|
|
|
+ * @param nickName 微信昵称
|
|
|
|
+ * @param avatarUrl 微信头像(headimgurl)
|
|
|
|
+ * @param unionId 微信unionId
|
|
|
|
+ * @param organizeId 组织Id
|
|
|
|
+ * @return UserLoginVo
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<UserLoginVo> invitationCodeOrganizeLogin(String invitationCode, String nickName, String avatarUrl, String unionId, Integer organizeId) {
|
|
|
|
+ // 参数校验
|
|
|
|
+ if (StringUtils.isBlank(invitationCode)) {
|
|
|
|
+ return ResponseJson.error("邀请码不能为空", null);
|
|
}
|
|
}
|
|
|
|
+ UserLoginVo operation = loginMapper.getOperationOrganizeUserByInvitationCode(invitationCode, organizeId);
|
|
|
|
+ if (operation == null) {
|
|
|
|
+ return ResponseJson.error("邀请码错误", null);
|
|
|
|
+ }
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.setTime(operation.getInvitationCodeTime());
|
|
|
|
+ calendar.add(Calendar.DATE, validTime);
|
|
|
|
+ if (1 == operation.getOperationStatus() && date.getTime() > calendar.getTime().getTime() && 0 == operation.getDelFlag()) {
|
|
|
|
+ return ResponseJson.error("邀请码已过期,请联系邀请人更新邀请码", null);
|
|
|
|
+ }
|
|
|
|
+ if (2 == operation.getOperationStatus() && 0 == operation.getDelFlag()) {
|
|
|
|
+ return ResponseJson.error("邀请码已被使用", null);
|
|
|
|
+ }
|
|
|
|
+ // 用户身份:1机构,2供应商
|
|
|
|
+ int userIdentity = 3 == operation.getUserIdentity() ? 2 : 1;
|
|
|
|
+ if (1 == userIdentity && operation.getClubStatus() != null && 91 == operation.getClubStatus()) {
|
|
|
|
+ return ResponseJson.error("您的机构已冻结", null);
|
|
|
|
+ }
|
|
|
|
+ if (2 == userIdentity && operation.getShopStatus() != null && 91 == operation.getShopStatus()) {
|
|
|
|
+ return ResponseJson.error("您的企业账号已被冻结,请联系客服处理", null);
|
|
|
|
+ }
|
|
|
|
+ if (0 != operation.getDelFlag()) {
|
|
|
|
+ return ResponseJson.error("您的邀请码已被删除,请重新添加运营人员", null);
|
|
|
|
+ }
|
|
|
|
+ OperationPo operationPo = new OperationPo();
|
|
|
|
+ operationPo.setId(operation.getOperationId());
|
|
|
|
+ // 微信unionId
|
|
|
|
+ operationPo.setUnionId(unionId);
|
|
|
|
+ Map<Object, Object> infoData = redisService.getEntries("wxInfo:applets:" + unionId);
|
|
|
|
+ // 微信openId
|
|
|
|
+ operationPo.setOpenId((String) infoData.get(WeChatService.Keys.OPEN_ID));
|
|
|
|
+ // 微信昵称
|
|
|
|
+ operationPo.setNickName(nickName);
|
|
|
|
+ // 微信头像
|
|
|
|
+ operationPo.setAvatarUrl(avatarUrl);
|
|
|
|
+ // 绑定状态,1未绑定,2已绑定
|
|
|
|
+ operationPo.setStatus(2);
|
|
|
|
+
|
|
|
|
+ // 联合丽格没有运营人员为机构运营人员
|
|
|
|
+ // 机构Id
|
|
|
|
+ operationPo.setClubId(operation.getClubId());
|
|
|
|
+ // 用户类型
|
|
|
|
+ operationPo.setUserType(1);
|
|
|
|
+ operationPo.setUpdateTime(new Date());
|
|
|
|
+ operationPo.setBindTime(new Date());
|
|
// 更新运营人员信息
|
|
// 更新运营人员信息
|
|
operationMapper.updateOperationByInvitation(operationPo);
|
|
operationMapper.updateOperationByInvitation(operationPo);
|
|
// 返回登录校验结果
|
|
// 返回登录校验结果
|