From 4ea3992530e9577e4a2919ada620542c3a6fa71d Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期一, 15 四月 2019 10:16:12 +0800
Subject: [PATCH] bug优化

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java |  164 +++++++++++++++++++++++++++---------------------------
 1 files changed, 82 insertions(+), 82 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
index ec28afe..bfd0b6e 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -40,9 +40,9 @@
 import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
 import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
 import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
+import com.yeshi.fanli.entity.common.JumpDetailV2;
 import com.yeshi.fanli.entity.goods.CommonGoods;
 import com.yeshi.fanli.entity.goods.RecommendUserGoods;
-import com.yeshi.fanli.entity.system.BusinessSystem;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
 import com.yeshi.fanli.exception.goods.CommonGoodsException;
@@ -535,98 +535,97 @@
 	 */
 	@RequestMapping(value = "getHomeMsgListNew", method = RequestMethod.POST)
 	public void getHomeMsgListNew(AcceptData acceptData, Long uid, PrintWriter out) {
-
-		if (uid == null) {
-			out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
-			return;
-		}
-		
-		BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
-				acceptData.getPackages());
-		if (system == null) {
-			out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�"));
-			return;
-		}
-		
-		int page = 1;
-		List<UserMsgVO> list = new ArrayList<>();
-		List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
-		if (detailList != null && detailList.size() > 0) {
-			for (MsgOrderDetail detail : detailList) {
-				UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
-				userMsgVO.setType(MSG_TYPE_ORDER);
-				list.add(userMsgVO);
-			}
-		}
-
-		List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page);
-		if (detailList1 != null && detailList1.size() > 0) {
-			for (MsgMoneyDetail detail : detailList1) {
-				UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
-				userMsgVO.setType(MSG_TYPE_MONEY);
-				list.add(userMsgVO);
-			}
-		}
-
-		List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page);
-		if (detailList2 != null && detailList2.size() > 0) {
-			for (MsgAccountDetail detail : detailList2) {
-				UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
-				userMsgVO.setType(MSG_TYPE_ACCOUNT);
-				list.add(userMsgVO);
-			}
-		}
-
-		List<MsgInviteDetail> detailList3 = msgInviteDetailService.listMsgInviteDetail(uid, page);
-		if (detailList3 != null && detailList3.size() > 0) {
-			for (MsgInviteDetail detail : detailList3) {
-				UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
-				if (userMsgVO != null) {
-					userMsgVO.setType(MSG_TYPE_INVITE);
-					list.add(userMsgVO);
-				}
-			}
-		}
-
-		List<MsgOtherDetail> detailList4 = msgOtherDetailService.listMsgOtherDetail(uid, page);
-		if (detailList4 != null && detailList4.size() > 0) {
-			for (MsgOtherDetail detail : detailList4) {
-				UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
-				if (userMsgVO != null) {
-					userMsgVO.setType(MSG_TYPE_OTHER);
-					list.add(userMsgVO);
-				}
-			}
-		}
 		
 		List<UserMsgCenter> listCenter = new ArrayList<>();
 		
+		// 1銆佹椿鍔ㄥ尯鍩�
 		List<Special> listSpecial = specialService.listByPlaceKey("msg_activities");
 		if (listSpecial != null && listSpecial.size() > 0) {
 			for (Special special: listSpecial) {
+				
+				boolean needLogin = special.isJumpLogin();
+				JumpDetailV2 jumpDetail = special.getJumpDetail();
+				if (jumpDetail != null) {
+					jumpDetail.setNeedLogin(needLogin);
+					special.setJumpDetail(jumpDetail);
+				}
+				
 				UserMsgCenter msgCenter = new UserMsgCenter();
 				msgCenter.setSpecial(special);
 				listCenter.add(msgCenter);
 			}
 		}
 		
-		if (list.size() > 0 ) {
-			// 鏃堕棿鎺掑簭
-			listSort(list);
-			
-			if (list.size() >= 20 ) {
-				list = list.subList(0, 19);
+		// 2銆佹秷鎭尯鍩�
+		if (uid != null && uid > 0) {
+			int page = 1;
+			List<UserMsgVO> list = new ArrayList<>();
+			List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
+			if (detailList != null && detailList.size() > 0) {
+				for (MsgOrderDetail detail : detailList) {
+					UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
+					userMsgVO.setType(MSG_TYPE_ORDER);
+					list.add(userMsgVO);
+				}
+			}
+
+			List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page);
+			if (detailList1 != null && detailList1.size() > 0) {
+				for (MsgMoneyDetail detail : detailList1) {
+					UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
+					userMsgVO.setType(MSG_TYPE_MONEY);
+					list.add(userMsgVO);
+				}
+			}
+
+			List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page);
+			if (detailList2 != null && detailList2.size() > 0) {
+				for (MsgAccountDetail detail : detailList2) {
+					UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
+					userMsgVO.setType(MSG_TYPE_ACCOUNT);
+					list.add(userMsgVO);
+				}
+			}
+
+			List<MsgInviteDetail> detailList3 = msgInviteDetailService.listMsgInviteDetail(uid, page);
+			if (detailList3 != null && detailList3.size() > 0) {
+				for (MsgInviteDetail detail : detailList3) {
+					UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
+					if (userMsgVO != null) {
+						userMsgVO.setType(MSG_TYPE_INVITE);
+						list.add(userMsgVO);
+					}
+				}
+			}
+
+			List<MsgOtherDetail> detailList4 = msgOtherDetailService.listMsgOtherDetail(uid, page);
+			if (detailList4 != null && detailList4.size() > 0) {
+				for (MsgOtherDetail detail : detailList4) {
+					UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
+					if (userMsgVO != null) {
+						userMsgVO.setType(MSG_TYPE_OTHER);
+						list.add(userMsgVO);
+					}
+				}
 			}
 			
-			for (UserMsgVO userMsgVO: list) {
-				UserMsgCenter userMsgCenter = new UserMsgCenter();
-				userMsgCenter.setUserMsg(userMsgVO);
-				listCenter.add(userMsgCenter);
+			if (list.size() > 0 ) {
+				// 鏃堕棿鎺掑簭
+				listSort(list);
+				
+				if (list.size() >= 20 ) {
+					list = list.subList(0, 19);
+				}
+				
+				for (UserMsgVO userMsgVO: list) {
+					UserMsgCenter userMsgCenter = new UserMsgCenter();
+					userMsgCenter.setUserMsg(userMsgVO);
+					listCenter.add(userMsgCenter);
+				}
 			}
 		}
 		
-		
-		// 娣诲姞娆㈣繋璇�
+		// 3銆佹坊鍔犳杩庤
 		Long time = (uid == null ? System.currentTimeMillis() : userInfoService.selectByPKey(uid).getCreatetime());
 		// 鍒涘缓鏃堕棿鍦�28鍙峰悗鐨勬墠鏈夋柊浜烘杩�
 		if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) {
@@ -641,14 +640,15 @@
 		
 		GsonBuilder builder = new GsonBuilder();
 		builder = getTimeDescJsonBuilder(builder);
-		
 		JSONObject root = new JSONObject();
 		
-		UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
-		UserSystemMsg usm = userSystemMsgService.getLatestUserSystemMsg(uid);
-		if (usm != null) {
-			root.put("systemMsg", new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), "绯荤粺娑堟伅", usm.getTitle(),
-				usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "", "http://img.flqapp.com/resource/msg/icon_msg_system.png",getTimeDesc(new Date(), usm.getCreateTime()), num.getTypeSystem()));
+		if (uid != null && uid > 0) {
+			UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
+			UserSystemMsg usm = userSystemMsgService.getLatestUserSystemMsg(uid);
+			if (usm != null) {
+				root.put("systemMsg", new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), "绯荤粺娑堟伅", usm.getTitle(),
+					usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "", "http://img.flqapp.com/resource/msg/icon_msg_system.png",getTimeDesc(new Date(), usm.getCreateTime()), num.getTypeSystem()));
+			}
 		}
 		
 		root.put("list", builder.create().toJson(listCenter));

--
Gitblit v1.8.0