From 88b54772dbcf5ecab1e2316e4e4626ac901b8908 Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期二, 22 一月 2019 15:58:24 +0800 Subject: [PATCH] 邀请码添加返回状态 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java | 65 +++++++++++++++++++++++++++++--- 1 files changed, 58 insertions(+), 7 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java index c437e29..911b5ae 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java @@ -44,6 +44,7 @@ import com.yeshi.fanli.exception.UserAccountException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.hongbao.HongBaoService; +import com.yeshi.fanli.service.inter.msg.UserAccountMsgNotificationService; import com.yeshi.fanli.service.inter.user.SpreadUserImgService; import com.yeshi.fanli.service.inter.user.UserAccountService; import com.yeshi.fanli.util.Constant; @@ -51,7 +52,11 @@ import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TimeUtil; import com.yeshi.fanli.util.factory.AccountDetailsFactory; +import com.yeshi.fanli.util.factory.msg.MsgAccountDetailFactory; import com.yeshi.fanli.util.wx.WXLoginUtil; + +import net.sf.json.JSONObject; + import org.yeshi.utils.JsonUtil; import org.yeshi.utils.tencentcloud.COSManager; @@ -96,10 +101,23 @@ @Resource private SpreadUserImgService spreadUserImgService; + @Resource + private UserAccountMsgNotificationService userAccountMsgNotificationService; + @Transactional @Override public LoginResult login(HttpServletRequest request, Boolean first, String appId, String code, String phone, UserInfo tbUserInfo, boolean wxinstall, int loginType) throws UserAccountException { + + JSONObject logInfo = new JSONObject(); + logInfo.put("appId", appId); + logInfo.put("code", code); + logInfo.put("phone", phone); + if (tbUserInfo != null) + logInfo.put("tbUserInfo", tbUserInfo.getId()); + logInfo.put("loginType", loginType); + LogHelper.lgoinInfo(logInfo.toString()); + HttpSession session = request.getSession(); if (first != null && first == true) session.removeAttribute("LAST_LOGIN_USER"); @@ -206,13 +224,17 @@ // 缁戝畾鍏崇郴 UserInfo updateUserInfo = new UserInfo(userInfo.getId()); - if (!StringUtil.isNullOrEmpty(lastUser.getPhone())) + if (!StringUtil.isNullOrEmpty(lastUser.getPhone())) { updateUserInfo.setPhone(lastUser.getPhone()); - + userAccountMsgNotificationService.bindingSuccess(userInfo.getId(), + MsgAccountDetailFactory.TYPE_PHONE); + } if (!StringUtil.isNullOrEmpty(lastUser.getOpenid())) { updateUserInfo.setOpenid(lastUser.getOpenid()); updateUserInfo.setTbName(lastUser.getTbName()); updateUserInfo.setTbPic(lastUser.getTbPic()); + userAccountMsgNotificationService.bindingSuccess(userInfo.getId(), + MsgAccountDetailFactory.TYPE_TB); } updateUserInfo.setLastLoginTime(System.currentTimeMillis()); userInfoMapper.updateByPrimaryKeySelective(updateUserInfo); @@ -303,6 +325,15 @@ @Override public LoginResult loginNoInstallWX(String appId, String code, String phone, UserInfo tbUserInfo, int loginType) throws UserAccountException { + JSONObject logInfo = new JSONObject(); + logInfo.put("appId", appId); + logInfo.put("code", code); + logInfo.put("phone", phone); + if (tbUserInfo != null) + logInfo.put("tbUserInfo", tbUserInfo.getId()); + logInfo.put("loginType", loginType); + LogHelper.lgoinInfo(logInfo.toString()); + UserInfo userInfo = null; WeiXinUser weiXinUser = null; switch (loginType) { @@ -510,6 +541,7 @@ moneyRecordMapper.insertSelective(moneyRecord); } + userAccountMsgNotificationService.connectSuccess(mainUser.getId(), lessUser.getId()); } /** @@ -519,7 +551,12 @@ * @param unionId * @return */ - public UserInfo getUserInfoByWXUnionId(String appId, String unionId) { + public UserInfo getUserInfoByWXUnionId(String appId, String unionId) throws UserAccountException { + if (StringUtil.isNullOrEmpty(appId)) + throw new UserAccountException(1, "appId涓虹┖"); + if (StringUtil.isNullOrEmpty(unionId)) + throw new UserAccountException(2, "unionId涓虹┖"); + return userInfoMapper.getUserInfoByAppIdAndWXUnionId(appId, unionId); } @@ -530,8 +567,11 @@ * @param openId * @return */ - public UserInfo getUserInfoByTaoBaoOpenId(String appId, String openId) { - + public UserInfo getUserInfoByTaoBaoOpenId(String appId, String openId) throws UserAccountException { + if (StringUtil.isNullOrEmpty(appId)) + throw new UserAccountException(1, "appId涓虹┖"); + if (StringUtil.isNullOrEmpty(openId)) + throw new UserAccountException(2, "openId涓虹┖"); return userInfoMapper.getUserInfoByAppIdAndTaoBaoOpenId(appId, openId); } @@ -542,8 +582,11 @@ * @param phone * @return */ - public UserInfo getUserInfoByPhone(String appId, String phone) { - + public UserInfo getUserInfoByPhone(String appId, String phone) throws UserAccountException { + if (StringUtil.isNullOrEmpty(appId)) + throw new UserAccountException(1, "appId涓虹┖"); + if (StringUtil.isNullOrEmpty(phone)) + throw new UserAccountException(2, "phone涓虹┖"); return userInfoMapper.getUserInfoByAppIdAndPhone(appId, phone); } @@ -624,6 +667,7 @@ UserInfo update = new UserInfo(user.getId()); update.setPhone(phone); userInfoMapper.updateByPrimaryKeySelective(update); + userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_PHONE); } @Override @@ -644,6 +688,7 @@ UserInfo updateUserInfo = new UserInfo(uid); updateUserInfo.setPhone(""); userInfoMapper.updateByPrimaryKeySelective(updateUserInfo); + userAccountMsgNotificationService.unBindingSuccess(uid, MsgAccountDetailFactory.TYPE_PHONE); } @Override @@ -669,6 +714,8 @@ update.setPortrait(tbPortrait); } userInfoMapper.updateByPrimaryKeySelective(update); + + userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_TB); } @Override @@ -693,6 +740,8 @@ } userInfoMapper.updateByPrimaryKeySelective(update); + + userAccountMsgNotificationService.unBindingSuccess(uid, MsgAccountDetailFactory.TYPE_TB); } @Override @@ -725,6 +774,8 @@ updateUserInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait()); } userInfoMapper.updateByPrimaryKeySelective(updateUserInfo); + + userAccountMsgNotificationService.changeBindingSuccess(uid, MsgAccountDetailFactory.TYPE_WX); } @Override -- Gitblit v1.8.0