From 573c491b4a1ba60e12a5678a01c1546c0077c1ee Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 30 七月 2019 09:07:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java | 95 ++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 80 insertions(+), 15 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 07aed3f..663cf58 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 @@ -76,6 +76,7 @@ import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TimeUtil; +import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.factory.CommonGoodsFactory; import com.yeshi.fanli.util.factory.msg.UserMsgVOFactory; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; @@ -189,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); @@ -292,7 +297,12 @@ data.put("totalCount", 0); } } catch (UserCustomSettingsException e) { - e.printStackTrace(); + } + + 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)); @@ -302,6 +312,12 @@ int totalCount = num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder() + num.getTypeScore() + num.getTypeSystem() + num.getTypeOther(); + + // 1.5.50鍙婁互鍚庣殑鐗堟湰闇�瑕佹坊鍔犺澶囨湭璇绘秷鎭� + if (VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion())) { + totalCount += msgDeviceReadStateService.getUnReadCount(acceptData.getDevice(), + "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, MsgDeviceReadState.TYPE_KEFU); + } JSONObject data = null; if ("android".equalsIgnoreCase(acceptData.getPlatform())) { @@ -576,6 +592,35 @@ out.print(JsonUtil.loadTrueResult(root)); } + private UserCommonMsgVO getKeFuMsg(AcceptData acceptData) { + MsgDeviceReadState kefuState = msgDeviceReadStateService.getByDeviceAndPlatformAndType( + UserCommonMsgVO.TYPE_KEFU, acceptData.getDevice(), + acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2); + // 浜哄伐瀹㈡湇 + UserCommonMsgVO vo = new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_kefu.png", "浜哄伐瀹㈡湇", new Date(), + UserCommonMsgVO.TYPE_KEFU, "", false, null, null, 0); + if (kefuState != null) { + vo.setUnReadCount(kefuState.getUnReadCount() == null ? 0 : kefuState.getUnReadCount()); + if (!StringUtil.isNullOrEmpty(kefuState.getLatestContent())) + vo.setLatestMsg(kefuState.getLatestContent()); + + if (vo.getUnReadCount() != null && vo.getUnReadCount() > 0) + 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; + } + /** * 鑾峰彇娑堟伅鍒楄〃 * @@ -600,7 +645,7 @@ // 瀹樺浠诲姟 if (uid != null) { MsgCommonDTO guanXuanMsg = msgConfigService.getGuanXuanMsg(); - if (guanXuanMsg != null) { + if (guanXuanMsg != null && guanXuanMsg.getShow() == true) { boolean read = false; UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid); if (num != null && (num.getGuanXuanReadTime() != null @@ -613,16 +658,14 @@ } else commonMsgList.add(new UserCommonMsgVO(guanXuanMsg.getIcon(), guanXuanMsg.getTitle(), guanXuanMsg.getUpdateTime(), UserCommonMsgVO.TYPE_GUANXUAN, guanXuanMsg.getContent(), read, - guanXuanMsg.getJumpDetail(), guanXuanMsg.getParams())); + guanXuanMsg.getJumpDetail(), guanXuanMsg.getParams(), 0)); } } // 杩斿埄鍒稿皬鍔╂墜 MsgCommonDTO zhuShouMsg = msgConfigService.getZhuShouMsg(); - if (zhuShouMsg != null) { - + if (zhuShouMsg != null && zhuShouMsg.getShow() == true) { boolean read = false; - MsgDeviceReadState state = msgDeviceReadStateService.getByDeviceAndPlatformAndType( UserCommonMsgVO.TYPE_ZHUSHOU, acceptData.getDevice(), acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2); @@ -637,12 +680,11 @@ } else commonMsgList.add(new UserCommonMsgVO(zhuShouMsg.getIcon(), zhuShouMsg.getTitle(), zhuShouMsg.getUpdateTime(), UserCommonMsgVO.TYPE_ZHUSHOU, zhuShouMsg.getContent(), read, - zhuShouMsg.getJumpDetail(), zhuShouMsg.getParams())); + zhuShouMsg.getJumpDetail(), zhuShouMsg.getParams(), 0)); } // 浜哄伐瀹㈡湇 - commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_kefu.png", "浜哄伐瀹㈡湇", new Date(), - UserCommonMsgVO.TYPE_KEFU, "", false, null, null)); + commonMsgList.add(getKeFuMsg(acceptData)); // 鎺ㄨ崘璁板綍 DeviceActive deviceActive = deviceActiveService.getDeviceByDeviceAndPlatform(acceptData.getDevice(), @@ -657,12 +699,12 @@ 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, - jumpDetailV2Service.getByTypeCache("recommend_list"), null)); + list.get(0).getPushTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), read, + jumpDetailV2Service.getByTypeCache("recommend_list"), null, 0)); } } @@ -695,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); } @@ -935,4 +980,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