From d1fe0aeb6aa1f205c6cfae319ebc91f33c1db3f6 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期日, 05 五月 2019 12:36:01 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java | 78 +++++++++++++++++++++++++------------- 1 files changed, 51 insertions(+), 27 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 bfd0b6e..a253fb5 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 @@ -49,6 +49,7 @@ import com.yeshi.fanli.exception.goods.RecommendUserGoodsException; import com.yeshi.fanli.exception.msg.UserSystemMsgException; import com.yeshi.fanli.exception.user.UserCustomSettingsException; +import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; import com.yeshi.fanli.service.inter.config.BusinessSystemService; import com.yeshi.fanli.service.inter.goods.CommonGoodsService; import com.yeshi.fanli.service.inter.goods.RecommendUserGoodsService; @@ -61,6 +62,7 @@ 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.push.PushGoodsService; import com.yeshi.fanli.service.inter.user.UserCustomSettingsService; import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.util.Constant; @@ -70,6 +72,7 @@ import com.yeshi.fanli.util.factory.CommonGoodsFactory; import com.yeshi.fanli.util.factory.msg.UserMsgVOFactory; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; +import com.yeshi.fanli.vo.msg.UserCommonMsgVO; import com.yeshi.fanli.vo.msg.UserHomeMsgVO; import com.yeshi.fanli.vo.msg.UserMsgCenter; import com.yeshi.fanli.vo.msg.UserMsgVO; @@ -122,10 +125,15 @@ @Resource private RedisManager redisManager; - + @Resource private SpecialService specialService; - + + @Resource + private JumpDetailV2Service jumpDetailV2Service; + + @Resource + private PushGoodsService pushGoodsService; // 娑堟伅鐨勭被鍨� final static String MSG_TYPE_ORDER = "order"; @@ -398,7 +406,8 @@ */ @RequestMapping(value = "getHomeMsgList", method = RequestMethod.POST) public void getHomeMsgList(AcceptData acceptData, Long uid, int page, HttpSession session, PrintWriter out) { - + if (uid != null && uid == 0) + uid = null; String device = acceptData.getDevice(); if (device == null || device.trim().length() == 0) { out.print(JsonUtil.loadFalseResult("璁惧鍙蜂笉鑳戒负绌�")); @@ -522,8 +531,7 @@ root.put("count", count); out.print(JsonUtil.loadTrueResult(root)); } - - + /** * 鑾峰彇娑堟伅鍒楄〃 * @@ -535,27 +543,41 @@ */ @RequestMapping(value = "getHomeMsgListNew", method = RequestMethod.POST) public void getHomeMsgListNew(AcceptData acceptData, Long uid, PrintWriter out) { - + if (uid != null && uid == 0) + uid = null; + List<UserMsgCenter> listCenter = new ArrayList<>(); - + + // 鍗曟潯娑堟伅 + List<UserCommonMsgVO> commonMsgList = new ArrayList<>(); + + commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_kefu.png", "浜哄伐瀹㈡湇", new Date(), + UserCommonMsgVO.TYPE_KEFU, "", false, null, null)); + + // 鎺ㄨ崘璁板綍 + // list = pushGoodsService.listHistoryByPushTime(0, 1, uid, createTime); + commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_recommend.png", "鎺ㄨ崘璁板綍", + new Date(), UserCommonMsgVO.TYPE_RECOMMEND, "闃叉补闃叉按闃叉疆锛屾薄娓嶄竴鎶瑰嵆鍑�锛屼粠鑳冨埌蹇冪殑鏆栨剰", false, + jumpDetailV2Service.getByTypeCache("recommend_list"), null)); + // 1銆佹椿鍔ㄥ尯鍩� List<Special> listSpecial = specialService.listByPlaceKey("msg_activities"); if (listSpecial != null && listSpecial.size() > 0) { - for (Special special: listSpecial) { - + 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); } } - + // 2銆佹秷鎭尯鍩� if (uid != null && uid > 0) { int page = 1; @@ -608,23 +630,23 @@ } } } - - if (list.size() > 0 ) { + + if (list.size() > 0) { // 鏃堕棿鎺掑簭 listSort(list); - - if (list.size() >= 20 ) { + + if (list.size() >= 20) { list = list.subList(0, 19); } - - for (UserMsgVO userMsgVO: list) { + + 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鍙峰悗鐨勬墠鏈夋柊浜烘杩� @@ -632,30 +654,33 @@ Map<String, Object> map = new HashMap<String, Object>(); map.put("title", "鏂颁汉娆㈣繋"); map.put("content", "鎭枩浣狅紝鎴愪负杩斿埄鍒哥殑鐢ㄦ埛\n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁╄繑鍒╁埜鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒"); - map.put("createTime",new Date(time)); + map.put("createTime", new Date(time)); UserMsgCenter msgCenternre = new UserMsgCenter(); msgCenternre.setWelcomeMsg(map); listCenter.add(msgCenternre); } - + GsonBuilder builder = new GsonBuilder(); builder = getTimeDescJsonBuilder(builder); JSONObject root = new JSONObject(); - + 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("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)); + root.put("commonList", builder.create().toJson(commonMsgList)); root.put("count", listCenter.size()); out.print(JsonUtil.loadTrueResult(root)); } - public static void listSort(List<UserMsgVO> list) { Collections.sort(list, new Comparator<UserMsgVO>() { @@ -671,8 +696,7 @@ } }); } - - + /** * 鑾峰彇绯荤粺娑堟伅鍒楄〃 * -- Gitblit v1.8.0