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 | 151 ++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 109 insertions(+), 42 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 7f05b1a..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 @@ -62,20 +62,21 @@ import com.yeshi.fanli.service.inter.homemodule.SpecialService; import com.yeshi.fanli.service.inter.lable.QualityFactoryService; import com.yeshi.fanli.service.inter.money.msg.MsgMoneyDetailService; -import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService; 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.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; @@ -178,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; @@ -201,11 +201,12 @@ for (MsgOrderDetail detail : detailList) { JSONObject params = new JSONObject(); params.put("orderNo", detail.getOrderId()); - if (detail.getType() == MsgTypeOrderTypeEnum.share - || detail.getType() == MsgTypeOrderTypeEnum.invite) + if (detail.getType() == MsgTypeOrderTypeEnum.invite || detail.getType() == MsgTypeOrderTypeEnum.orderInvite) params.put("orderHideNo", UserUtil.filterOrderId(detail.getOrderId())); - list.add(UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"), - params)); + + UserMsgVO msgVO = UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"), params); + msgVO.setType(MSG_TYPE_ORDER); + list.add(msgVO); } break; case MSG_TYPE_MONEY: @@ -213,16 +214,22 @@ 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); @@ -231,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: @@ -244,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; } @@ -403,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 @@ -519,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) @@ -594,7 +605,9 @@ // 鍒涘缓鏃堕棿鍦�28鍙峰悗鐨勬墠鏈夋柊浜烘杩� if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) { UserHomeMsgVO vo = new UserHomeMsgVO(); - vo.setContent(String.format("鎭枩浣狅紝鎴愪负%s鐨勭敤鎴穃n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁�%s鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒",Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()),Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()))); + 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); @@ -745,8 +758,9 @@ // 1銆佹椿鍔ㄥ尯鍩� int platformCode = Constant.getPlatformCode(acceptData.getPlatform()); - - List<Special> listSpecial = specialService.listByPlaceKey("msg_activities", platformCode, Integer.parseInt(acceptData.getVersion())); + + List<Special> listSpecial = specialService.listByPlaceKey("msg_activities", platformCode, + Integer.parseInt(acceptData.getVersion())); if (listSpecial != null && listSpecial.size() > 0) { for (Special special : listSpecial) { @@ -772,8 +786,7 @@ for (MsgOrderDetail detail : detailList) { JSONObject params = new JSONObject(); params.put("orderNo", detail.getOrderId()); - if (detail.getType() == MsgTypeOrderTypeEnum.share - || detail.getType() == MsgTypeOrderTypeEnum.invite) + 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); @@ -844,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",String.format("鎭枩浣狅紝鎴愪负%s鐨勭敤鎴穃n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁�%s鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒",Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()),Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()))); + 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); @@ -873,26 +889,27 @@ /** * 鎻愰啋澶у浘 */ - MsgCommonDTO notify = msgConfigService.getNotifyMsg(); + 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)); + 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()); @@ -1059,4 +1076,54 @@ 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