yujian
2019-01-22 ca60a2588098250cb68a76dad135fa23d63ea952
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -112,7 +112,7 @@
      switch (type) {
      case MSG_TYPE_ORDER:
         msgOrderDetailService.readMsgByUid(uid);
         userMsgReadStateService.readOrderMsg(uid);
         List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
         count = msgOrderDetailService.countMsgOrderDetail(uid);
         if (detailList != null)
@@ -120,7 +120,7 @@
               list.add(UserMsgVOFactory.create(detail));
         break;
      case MSG_TYPE_MONEY:
         msgMoneyDetailService.readMsgByUid(uid);
         userMsgReadStateService.readMoneyMsg(uid);
         List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page);
         count = msgMoneyDetailService.countMsgMoneyDetail(uid);
         if (detailList1 != null)
@@ -128,7 +128,7 @@
               list.add(UserMsgVOFactory.create(detail));
         break;
      case MSG_TYPE_ACCOUNT:
         msgAccountDetailService.readMsgByUid(uid);
         userMsgReadStateService.readAccountMsg(uid);
         List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page);
         count = msgAccountDetailService.countMsgAccountDetail(uid);
         if (detailList2 != null)
@@ -136,7 +136,7 @@
               list.add(UserMsgVOFactory.create(detail));
         break;
      case MSG_TYPE_INVITE:
         msgInviteDetailService.readMsgByUid(uid);
         userMsgReadStateService.readInviteMsg(uid);
         List<MsgInviteDetail> detailList3 = msgInviteDetailService.listMsgInviteDetail(uid, page);
         count = msgInviteDetailService.countMsgInviteDetail(uid);
         if (detailList3 != null)
@@ -170,10 +170,7 @@
      JSONObject data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
      data.put("totalCount", num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
            + num.getTypeScore() + num.getTypeSystem());
      JSONObject root = new JSONObject();
      root.put("data", data);
      root.put("count", 1);
      out.print(JsonUtil.loadTrueResult(root));
      out.print(JsonUtil.loadTrueResult(data));
   }
   private String getTimeDesc(Date nowDate, Date targetDate) {
@@ -264,10 +261,12 @@
         }
         vo.setGoodsList(goodsList);
         vo.setTitle("猜你喜欢");
         vo.setIcon("http://img.flqapp.com/resource/msg/icon_msg_guess_like.png");
         volist.add(vo);
      }
      if (volist.size() < Constant.PAGE_SIZE) {
      if (volist.size() > 0 && volist.size() < Constant.PAGE_SIZE) {
         // 添加欢迎语
         UserHomeMsgVO vo = new UserHomeMsgVO();
         vo.setContent("恭喜你,成为返利券的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让返利券成为你的省钱助手吧!");
@@ -280,12 +279,15 @@
      JSONObject root = new JSONObject();
      root.put("msgList", new Gson().toJson(volist));
      if (page == 1) {
         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.getContent(),
                  usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "",
                  Constant.systemCommonConfig.getDefaultPortrait(), getTimeDesc(now, usm.getCreateTime())));
            root.put("systemMsg",
                  new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), usm.getTitle(),
                        usm.getContent(),
                        usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "",
                        Constant.systemCommonConfig.getDefaultPortrait(), getTimeDesc(now, usm.getCreateTime()),
                        num.getTypeSystem()));
      }
      root.put("count", count);
      out.print(JsonUtil.loadTrueResult(root));
@@ -313,11 +315,11 @@
            voList.add(new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), usm.getTitle(),
                  usm.getContent(),
                  usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "", null,
                  usm.getCreateTime().getTime() + ""));
                  usm.getCreateTime().getTime() + "", 0));
         }
      long count = userSystemMsgService.countUserSystemMsg(uid);
      userSystemMsgService.readMsgByUid(uid);
      userMsgReadStateService.readUserSystemMsg(uid);
      JSONObject root = new JSONObject();
      root.put("data", voList);