From c22963a2ee796e59094524cadc5a78c450ed98f8 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期四, 01 八月 2019 17:54:29 +0800
Subject: [PATCH] 动态分享无券 + 下架 不能分享

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java |   76 +++++++++++++++++++++++++++++++++++---
 1 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
index 8cf4ffb..6accc2b 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
@@ -190,8 +190,12 @@
 			List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
 			count = msgOrderDetailService.countMsgOrderDetail(uid);
 			if (detailList != null)
-				for (MsgOrderDetail detail : detailList)
-					list.add(UserMsgVOFactory.create(detail));
+				for (MsgOrderDetail detail : detailList) {
+					JSONObject params = new JSONObject();
+					params.put("orderNo", detail.getOrderId());
+					list.add(UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"),
+							params));
+				}
 			break;
 		case MSG_TYPE_MONEY:
 			userMsgReadStateService.readMoneyMsg(uid);
@@ -293,6 +297,12 @@
 					data.put("totalCount", 0);
 				}
 			} catch (UserCustomSettingsException e) {
+			}
+
+			if (VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion())) {
+				int totalCount = msgDeviceReadStateService.getUnReadCount(acceptData.getDevice(),
+						"android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, MsgDeviceReadState.TYPE_KEFU);
+				data.put("totalCount", totalCount);
 			}
 
 			out.print(JsonUtil.loadTrueResult(data));
@@ -598,7 +608,15 @@
 				vo.setRead(false);
 			else
 				vo.setRead(true);
-		}
+
+			if (kefuState.getLatestContentTime() != null)
+				vo.setTime(kefuState.getLatestContentTime());
+
+		} else
+			vo.setRead(true);
+
+		if (StringUtil.isNullOrEmpty(vo.getLatestMsg()))
+			vo.setLatestMsg("[鐐瑰嚮鎵撳紑浜哄伐瀹㈡湇]");
 
 		return vo;
 	}
@@ -681,11 +699,11 @@
 						acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
 				boolean read = false;
 				if (state != null && state.getReadTime() != null
-						&& list.get(0).getCreateTime().getTime() < state.getReadTime().getTime())
+						&& list.get(0).getPushTime().getTime() < state.getReadTime().getTime())
 					read = true;
 
 				commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_recommend.png", "鎺ㄨ崘璁板綍",
-						list.get(0).getCreateTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), read,
+						list.get(0).getPushTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), read,
 						jumpDetailV2Service.getByTypeCache("recommend_list"), null, 0));
 			}
 		}
@@ -719,7 +737,10 @@
 			List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
 			if (detailList != null && detailList.size() > 0) {
 				for (MsgOrderDetail detail : detailList) {
-					UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
+					JSONObject params = new JSONObject();
+					params.put("orderNo", detail.getOrderId());
+					UserMsgVO userMsgVO = UserMsgVOFactory.create(detail,
+							jumpDetailV2Service.getByTypeCache("order_search"), params);
 					userMsgVO.setType(MSG_TYPE_ORDER);
 					list.add(userMsgVO);
 				}
@@ -811,6 +832,29 @@
 								"http://img.flqapp.com/resource/msg/icon_msg_system.png",
 								getTimeDesc(new Date(), usm.getCreateTime()), num.getTypeSystem()));
 			}
+		}
+
+		/**
+		 * 鎻愰啋澶у浘
+		 */
+		MsgCommonDTO notify = msgConfigService.getNotifyMsg();
+
+		if (notify != null && notify.getShow() == true) {
+			boolean read = false;
+			MsgDeviceReadState state = msgDeviceReadStateService.getByDeviceAndPlatformAndType(
+					UserCommonMsgVO.TYPE_NOTIFY, acceptData.getDevice(),
+					acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
+			if (state != null && state.getReadTime() != null
+					&& zhuShouMsg.getUpdateTime().getTime() < state.getReadTime().getTime())
+				read = true;
+			if (notify.getJumpDetail() == null)
+				read = true;
+			// 鏌ヨ鏄惁宸茶
+			UserCommonMsgVO vo = new UserCommonMsgVO(notify.getIcon(), notify.getTitle(), notify.getUpdateTime(),
+					UserCommonMsgVO.TYPE_NOTIFY, notify.getContent(), read, notify.getJumpDetail(), notify.getParams(),
+					0);
+			vo.setPicture(notify.getPicture());
+			root.put("notifyMsg", builder.create().toJson(vo));
 		}
 
 		root.put("list", builder.create().toJson(listCenter));
@@ -959,4 +1003,24 @@
 		out.print(JsonUtil.loadTrueResult(""));
 	}
 
+	/**
+	 * 涓婁紶鏈�杩戠殑瀹㈡湇娑堟伅
+	 * 
+	 * @param acceptData
+	 * @param content
+	 * @param time
+	 * @param out
+	 */
+	@RequestMapping(value = "uploadLatestKeFuMsg", method = RequestMethod.POST)
+	public void uploadLatestKeFuMsg(AcceptData acceptData, String content, Long datetime, PrintWriter out) {
+
+		if (StringUtil.isNullOrEmpty(content) || datetime == null) {
+			out.print(JsonUtil.loadFalseResult("鍙傛暟涓嶅畬鏁�"));
+			return;
+		}
+		msgDeviceReadStateService.addUnreadDeviceMsg(MsgDeviceReadState.TYPE_KEFU, acceptData.getDevice(),
+				"android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, 0, content, new Date(datetime));
+		out.print(JsonUtil.loadTrueResult(""));
+	}
+
 }

--
Gitblit v1.8.0