From 033a7cd02b9799a0acf42290fdc84d74bdcee79c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 29 一月 2019 15:33:12 +0800
Subject: [PATCH] 热门搜素更改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 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 80d62ee..e325927 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,13 +44,16 @@
 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.service.inter.user.UserExtraTaoBaoInfoService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.FileUtil;
 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;
@@ -98,6 +101,12 @@
 
 	@Resource
 	private SpreadUserImgService spreadUserImgService;
+
+	@Resource
+	private UserAccountMsgNotificationService userAccountMsgNotificationService;
+	
+	@Resource
+	private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
 
 	@Transactional
 	@Override
@@ -219,13 +228,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);
@@ -532,6 +545,7 @@
 			moneyRecordMapper.insertSelective(moneyRecord);
 		}
 
+		userAccountMsgNotificationService.connectSuccess(mainUser.getId(), lessUser.getId());
 	}
 
 	/**
@@ -657,6 +671,7 @@
 		UserInfo update = new UserInfo(user.getId());
 		update.setPhone(phone);
 		userInfoMapper.updateByPrimaryKeySelective(update);
+		userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_PHONE);
 	}
 
 	@Override
@@ -677,6 +692,7 @@
 		UserInfo updateUserInfo = new UserInfo(uid);
 		updateUserInfo.setPhone("");
 		userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
+		userAccountMsgNotificationService.unBindingSuccess(uid, MsgAccountDetailFactory.TYPE_PHONE);
 	}
 
 	@Override
@@ -686,8 +702,12 @@
 		if (user == null)
 			throw new UserAccountException(4, "鐢ㄦ埛涓嶅瓨鍦�");
 
-		if (!StringUtil.isNullOrEmpty(user.getOpenid()))
+		if (!StringUtil.isNullOrEmpty(user.getOpenid()) && !user.getOpenid().equalsIgnoreCase(tbOpenId))
 			throw new UserAccountException(5, "褰撳墠璐﹀彿宸茬粡缁戝畾浜嗘窐瀹濓紝璇峰厛瑙g粦");
+
+		//缁戝畾鍚屼竴涓窐瀹濆彿
+		if (!StringUtil.isNullOrEmpty(user.getOpenid()) && user.getOpenid().equalsIgnoreCase(tbOpenId))
+			return;
 
 		UserInfo taoBaoUser = getUserInfoByTaoBaoOpenId(user.getAppId(), tbOpenId);
 		if (taoBaoUser != null)
@@ -702,6 +722,8 @@
 			update.setPortrait(tbPortrait);
 		}
 		userInfoMapper.updateByPrimaryKeySelective(update);
+
+		userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_TB);
 	}
 
 	@Override
@@ -726,6 +748,10 @@
 		}
 
 		userInfoMapper.updateByPrimaryKeySelective(update);
+		
+		userExtraTaoBaoInfoService.unBindUid(uid);
+
+		userAccountMsgNotificationService.unBindingSuccess(uid, MsgAccountDetailFactory.TYPE_TB);
 	}
 
 	@Override
@@ -758,6 +784,8 @@
 			updateUserInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
 		}
 		userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
+
+		userAccountMsgNotificationService.changeBindingSuccess(uid, MsgAccountDetailFactory.TYPE_WX);
 	}
 
 	@Override

--
Gitblit v1.8.0