From 98b1a0affd69bbe63223c21fdd2c404e8bedfccb Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 20 五月 2020 17:25:08 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into 2.1.2 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java | 214 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 190 insertions(+), 24 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 c973cf0..3089d9f 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 @@ -39,9 +39,11 @@ import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail; import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail; import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail; +import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum; 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.bus.user.UserInfoExtra; import com.yeshi.fanli.entity.common.JumpDetailV2; import com.yeshi.fanli.entity.goods.CommonGoods; import com.yeshi.fanli.entity.goods.RecommendUserGoods; @@ -59,24 +61,28 @@ import com.yeshi.fanli.service.inter.goods.RecommendUserGoodsService; import com.yeshi.fanli.service.inter.homemodule.SpecialService; import com.yeshi.fanli.service.inter.lable.QualityFactoryService; -import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService; +import com.yeshi.fanli.service.inter.money.msg.MsgMoneyDetailService; import com.yeshi.fanli.service.inter.msg.MsgConfigService; import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService; -import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService; -import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService; -import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService; import com.yeshi.fanli.service.inter.msg.MsgOtherDetailService; import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService; import com.yeshi.fanli.service.inter.msg.UserSystemMsgService; +import com.yeshi.fanli.service.inter.order.msg.MsgOrderDetailService; import com.yeshi.fanli.service.inter.push.DeviceActiveService; import com.yeshi.fanli.service.inter.push.PushGoodsService; import com.yeshi.fanli.service.inter.user.UserCustomSettingsService; +import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; +import com.yeshi.fanli.service.inter.user.invite.MsgInviteDetailService; +import com.yeshi.fanli.service.inter.user.msg.MsgAccountDetailService; import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.RedisKeyEnum; 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.account.UserUtil; +import com.yeshi.fanli.util.annotation.RequestSerializableByKey; import com.yeshi.fanli.util.factory.CommonGoodsFactory; import com.yeshi.fanli.util.factory.msg.UserMsgVOFactory; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; @@ -152,6 +158,9 @@ @Resource private MsgDeviceReadStateService msgDeviceReadStateService; + @Resource + private UserInfoExtraService userInfoExtraService; + // 娑堟伅鐨勭被鍨� final static String MSG_TYPE_ORDER = "order"; final static String MSG_TYPE_MONEY = "money"; @@ -170,7 +179,6 @@ */ @RequestMapping(value = "getMsgList", method = RequestMethod.POST) public void getMsgList(AcceptData acceptData, Long uid, int page, String type, PrintWriter out) { - if (uid == null) { out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); return; @@ -190,24 +198,38 @@ 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()); + if (detail.getType() == MsgTypeOrderTypeEnum.invite || detail.getType() == MsgTypeOrderTypeEnum.orderInvite) + params.put("orderHideNo", UserUtil.filterOrderId(detail.getOrderId())); + + UserMsgVO msgVO = UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"), params); + msgVO.setType(MSG_TYPE_ORDER); + list.add(msgVO); + } break; case MSG_TYPE_MONEY: userMsgReadStateService.readMoneyMsg(uid); List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page); count = msgMoneyDetailService.countMsgMoneyDetail(uid); if (detailList1 != null) - for (MsgMoneyDetail detail : detailList1) - list.add(UserMsgVOFactory.create(detail)); + for (MsgMoneyDetail detail : detailList1) { + UserMsgVO msgVO = UserMsgVOFactory.create(detail); + msgVO.setType(MSG_TYPE_MONEY); + list.add(msgVO); + } break; case MSG_TYPE_ACCOUNT: userMsgReadStateService.readAccountMsg(uid); List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page); count = msgAccountDetailService.countMsgAccountDetail(uid); if (detailList2 != null) - for (MsgAccountDetail detail : detailList2) - list.add(UserMsgVOFactory.create(detail)); + for (MsgAccountDetail detail : detailList2) { + UserMsgVO msgVO = UserMsgVOFactory.create(detail); + msgVO.setType(MSG_TYPE_ACCOUNT); + list.add(msgVO); + } break; case MSG_TYPE_INVITE: userMsgReadStateService.readInviteMsg(uid); @@ -216,10 +238,12 @@ if (detailList3 != null) for (MsgInviteDetail detail : detailList3) { UserMsgVO vo = UserMsgVOFactory.create(detail); - if (vo != null) + if (vo != null) { + vo.setType(MSG_TYPE_INVITE); list.add(vo); - else + } else { count--; + } } break; case MSG_TYPE_OTHER: @@ -229,10 +253,12 @@ if (detailList4 != null) for (MsgOtherDetail detail : detailList4) { UserMsgVO vo = UserMsgVOFactory.create(detail); - if (vo != null) + if (vo != null) { + vo.setType(MSG_TYPE_OTHER); list.add(vo); - else + } else { count--; + } } break; } @@ -252,6 +278,7 @@ * @param uid * @param out */ + @RequestSerializableByKey(key = "#acceptData.device") @RequestMapping(value = "getUnReadMsgCount", method = RequestMethod.POST) public void getUnReadMsgCount(AcceptData acceptData, Long uid, PrintWriter out) { GsonBuilder androidBuilder = new GsonBuilder().registerTypeAdapter(Integer.class, @@ -295,6 +322,12 @@ } 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); + } + data.put("mineCount", 0); out.print(JsonUtil.loadTrueResult(data)); return; } @@ -316,6 +349,18 @@ data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num)); } data.put("totalCount", totalCount); + // "鎴戠殑"閫夐」瑙掓爣 + int welfareCenterNews = 0; + if (uid != null) { + UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); + if (userInfoExtra != null) { + if (userInfoExtra.getCouponNews() != null) { + welfareCenterNews = userInfoExtra.getCouponNews(); + } + } + } + + data.put("mineCount", welfareCenterNews); try { UserSettingsVO vo = userCustomSettingsService.getMySettings(uid); @@ -369,7 +414,7 @@ } private void addRecommendGoods(Long uid, String device, String imei, String idfa) { - TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(1, 50, imei, idfa); + TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(1, 50, imei, idfa,""); if (result != null && result.getTaoBaoGoodsBriefs() != null) { for (int i = 0; i < result.getTaoBaoGoodsBriefs().size(); i++) { if (result.getTaoBaoGoodsBriefs().get(i).getCouponAmount() == null @@ -458,6 +503,9 @@ public void getHomeMsgList(AcceptData acceptData, Long uid, int page, HttpSession session, PrintWriter out) { if (uid != null && uid == 0) uid = null; + if (uid != null) + userSystemMsgService.syncSystemZNX(uid); + String device = acceptData.getDevice(); if (device == null || device.trim().length() == 0) { out.print(JsonUtil.loadFalseResult("璁惧鍙蜂笉鑳戒负绌�")); @@ -482,7 +530,7 @@ } // String key = "recommend-goods-user-" + uid; - String key = "recommend-goods-user-" + device; + String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.recommendGoodsUser, device); if (Constant.IS_OUTNET) { if (canAdd && StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) { if (Constant.IS_OUTNET) @@ -557,7 +605,9 @@ // 鍒涘缓鏃堕棿鍦�28鍙峰悗鐨勬墠鏈夋柊浜烘杩� if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) { UserHomeMsgVO vo = new UserHomeMsgVO(); - vo.setContent("鎭枩浣狅紝鎴愪负杩斿埄鍒哥殑鐢ㄦ埛\n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁╄繑鍒╁埜鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒"); + vo.setContent(String.format("鎭枩浣狅紝鎴愪负%s鐨勭敤鎴穃n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁�%s鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒", + Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()), + Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()))); vo.setTitle("鏂颁汉娆㈣繋"); vo.setCreateTime(getTimeDesc(now, new Date(time))); vo.setType(UserHomeMsgVO.TYPE_WELCOME); @@ -598,8 +648,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; } @@ -613,10 +670,14 @@ * @param type * @param out */ + @RequestSerializableByKey(key = "#acceptData.device") @RequestMapping(value = "getHomeMsgListNew", method = RequestMethod.POST) public void getHomeMsgListNew(AcceptData acceptData, Long uid, PrintWriter out) { if (uid != null && uid == 0) uid = null; + if (uid != null) { + userSystemMsgService.syncSystemZNX(uid); + } List<UserMsgCenter> listCenter = new ArrayList<>(); @@ -645,7 +706,7 @@ } } - // 杩斿埄鍒稿皬鍔╂墜 + // 鏉挎牀蹇渷灏忓姪鎵� MsgCommonDTO zhuShouMsg = msgConfigService.getZhuShouMsg(); if (zhuShouMsg != null && zhuShouMsg.getShow() == true) { boolean read = false; @@ -682,11 +743,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)); } } @@ -696,7 +757,10 @@ // list = pushGoodsService.listHistoryByPushTime(0, 1, uid, createTime); // 1銆佹椿鍔ㄥ尯鍩� - List<Special> listSpecial = specialService.listByPlaceKey("msg_activities"); + int platformCode = Constant.getPlatformCode(acceptData.getPlatform()); + + List<Special> listSpecial = specialService.listByPlaceKey("msg_activities", platformCode, + Integer.parseInt(acceptData.getVersion())); if (listSpecial != null && listSpecial.size() > 0) { for (Special special : listSpecial) { @@ -720,7 +784,12 @@ 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()); + if (detail.getType() == MsgTypeOrderTypeEnum.invite || detail.getType() == MsgTypeOrderTypeEnum.orderInvite) + params.put("orderHideNo", UserUtil.filterOrderId(detail.getOrderId())); + UserMsgVO userMsgVO = UserMsgVOFactory.create(detail, + jumpDetailV2Service.getByTypeCache("order_search"), params); userMsgVO.setType(MSG_TYPE_ORDER); list.add(userMsgVO); } @@ -788,7 +857,10 @@ if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) { Map<String, Object> map = new HashMap<String, Object>(); map.put("title", "鏂颁汉娆㈣繋"); - map.put("content", "鎭枩浣狅紝鎴愪负杩斿埄鍒哥殑鐢ㄦ埛\n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁╄繑鍒╁埜鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒"); + map.put("content", + String.format("鎭枩浣狅紝鎴愪负%s鐨勭敤鎴穃n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁�%s鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒", + Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()), + Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()))); map.put("createTime", new Date(time)); UserMsgCenter msgCenternre = new UserMsgCenter(); msgCenternre.setWelcomeMsg(map); @@ -814,6 +886,30 @@ } } + /** + * 鎻愰啋澶у浘 + */ + if (!"douyin".equalsIgnoreCase(acceptData.getChannel())) { + 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)); root.put("commonList", builder.create().toJson(commonMsgList)); root.put("count", listCenter.size()); @@ -960,4 +1056,74 @@ 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("")); + } + + + /** + * 鍒犻櫎娑堟伅 + * @param acceptData + * @param type + * @param id + * @param out + */ + @RequestMapping(value = "deleteMsg", method = RequestMethod.POST) + public void deleteMsg(AcceptData acceptData, String type, Long id, Long uid, PrintWriter out) { + if (StringUtil.isNullOrEmpty(type) || id == null || uid == null) { + out.print(JsonUtil.loadFalseResult("鍙傛暟涓嶅畬鏁�")); + return; + } + + switch (type) { + case MSG_TYPE_ORDER: + MsgOrderDetail msgOrderDetail = msgOrderDetailService.selectByPrimaryKey(id); + if (msgOrderDetail != null && msgOrderDetail.getUser().getId().longValue() == uid.longValue()) { + msgOrderDetailService.deleteByPrimaryKey(id); + } + break; + case MSG_TYPE_MONEY: + MsgMoneyDetail moneyDetail = msgMoneyDetailService.selectByPrimaryKey(id); + if (moneyDetail != null && moneyDetail.getUser().getId().longValue() == uid.longValue()) { + msgMoneyDetailService.deleteByPrimaryKey(id); + } + break; + case MSG_TYPE_ACCOUNT: + MsgAccountDetail accountDetail = msgAccountDetailService.selectByPrimaryKey(id); + if (accountDetail != null && accountDetail.getUser().getId().longValue() == uid.longValue()) { + msgAccountDetailService.deleteByPrimaryKey(id); + } + break; + case MSG_TYPE_INVITE: + MsgInviteDetail inviteDetail = msgInviteDetailService.selectByPrimaryKey(id); + if (inviteDetail != null && inviteDetail.getUser().getId().longValue() == uid.longValue()) { + msgInviteDetailService.deleteByPrimaryKey(id); + } + break; + case MSG_TYPE_OTHER: + MsgOtherDetail otherDetail = msgOtherDetailService.selectByPrimaryKey(id); + if (otherDetail != null && otherDetail.getUser().getId().longValue() == uid.longValue()) { + msgOtherDetailService.deleteByPrimaryKey(id); + } + break; + } + out.print(JsonUtil.loadTrueResult("")); + } + } -- Gitblit v1.8.0