yujian
2019-02-25 607193d080c531c7a0535f4006ac6d6b0ee27a17
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -54,6 +54,7 @@
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
@@ -102,6 +103,9 @@
   @Resource
   private UserCustomSettingsService userCustomSettingsService;
   @Resource
   private RedisManager redisManager;
   // 消息的类型
   final static String MSG_TYPE_ORDER = "order";
@@ -163,8 +167,13 @@
         List<MsgInviteDetail> detailList3 = msgInviteDetailService.listMsgInviteDetail(uid, page);
         count = msgInviteDetailService.countMsgInviteDetail(uid);
         if (detailList3 != null)
            for (MsgInviteDetail detail : detailList3)
               list.add(UserMsgVOFactory.create(detail));
            for (MsgInviteDetail detail : detailList3) {
               UserMsgVO vo = UserMsgVOFactory.create(detail);
               if (vo != null)
                  list.add(vo);
               else
                  count--;
            }
         break;
      }
@@ -351,8 +360,9 @@
            }
         }
         if (canAdd && session.getAttribute("recommendgoods") == null) {
            session.setAttribute("recommendgoods", 1);
         String key = "recommend-goods-user-" + uid;
         if (canAdd && StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
            redisManager.cacheCommonString(key, "1", 20);
            if (hour < 12)
               addRecommendGoods(uid);
            else
@@ -363,7 +373,7 @@
      List<UserHomeMsgVO> volist = new ArrayList<>();
      List<RecommendUserGoods> list = recommendUserGoodsService.listRecommend(uid, page, Constant.PAGE_SIZE);
      long count = recommendUserGoodsService.countRecommend(uid) + 1;// 计算欢迎语的数量
      long count = recommendUserGoodsService.countRecommend(uid);//
      Date now = new Date();
      for (RecommendUserGoods goods : list) {
@@ -406,14 +416,21 @@
         volist.add(vo);
      }
      Long time = userInfoService.getUserById(uid).getCreatetime();
      if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd"))
         count++;// 计算欢迎语的数量
      if (volist.size() > 0 && volist.size() < Constant.PAGE_SIZE) {
         // 添加欢迎语
         UserHomeMsgVO vo = new UserHomeMsgVO();
         vo.setContent("恭喜你,成为返利券的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让返利券成为你的省钱助手吧!");
         vo.setTitle("新人欢迎");
         vo.setCreateTime(getTimeDesc(now, new Date(userInfoService.getUserById(uid).getCreatetime())));
         vo.setType(UserHomeMsgVO.TYPE_WELCOME);
         volist.add(vo);
         // 创建时间在28号后的才有新人欢迎
         if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd")) {
            UserHomeMsgVO vo = new UserHomeMsgVO();
            vo.setContent("恭喜你,成为返利券的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让返利券成为你的省钱助手吧!");
            vo.setTitle("新人欢迎");
            vo.setCreateTime(getTimeDesc(now, new Date(time)));
            vo.setType(UserHomeMsgVO.TYPE_WELCOME);
            volist.add(vo);
         }
      }
      JSONObject root = new JSONObject();