|
@@ -367,7 +367,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);
|
|
@@ -1113,7 +1112,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);
|
|
@@ -1142,87 +1141,162 @@ 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);
|
|
|
|
|
|
+ operationPo.setUserType(1);
|
|
|
|
+ }
|
|
|
|
+ // 更新运营人员信息
|
|
|
|
+ operationMapper.updateOperationByInvitation(operationPo);
|
|
|
|
+ // 返回登录校验结果
|
|
|
|
+ return logonVerify(operation);
|
|
|
|
+ }
|
|
|
|
|
|
- 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);
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 邀请码登录
|
|
|
|
+ *
|
|
|
|
+ * @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);
|
|
|
|
|
|
- //发短信
|
|
|
|
- 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);
|
|
|
|
- }
|
|
|
|
|
|
+ // 联合丽格没有运营人员为机构运营人员
|
|
|
|
+ // 机构Id
|
|
|
|
+ operationPo.setClubId(operation.getClubId());
|
|
|
|
+ // 用户类型
|
|
|
|
+ operationPo.setUserType(1);
|
|
|
|
|
|
- }
|
|
|
|
// 更新运营人员信息
|
|
// 更新运营人员信息
|
|
operationMapper.updateOperationByInvitation(operationPo);
|
|
operationMapper.updateOperationByInvitation(operationPo);
|
|
// 返回登录校验结果
|
|
// 返回登录校验结果
|