| | |
| | | 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.user.UserInfoExtra;
|
| | | 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.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.exception.user.UserCustomSettingsException;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.money.msg.MsgMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgConfigService;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.msg.MsgOrderDetailService;
|
| | | 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.JumpDetailUtil;
|
| | | 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.msg.UserMsgVOFactory;
|
| | |
| | | import com.yeshi.fanli.vo.msg.UserMsgCenter;
|
| | | import com.yeshi.fanli.vo.msg.UserMsgVO;
|
| | | import com.yeshi.fanli.vo.msg.UserSystemMsgVO;
|
| | | import com.yeshi.fanli.vo.user.UserSettingsVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | @Resource
|
| | | private MsgDeviceReadStateService msgDeviceReadStateService;
|
| | |
|
| | |
|
| | | // 消息的类型
|
| | | final static String MSG_TYPE_ORDER = "order";
|
| | | final static String MSG_TYPE_MONEY = "money";
|
| | |
| | | final static String MSG_TYPE_INVITE = "invite";
|
| | | final static String MSG_TYPE_OTHER = "other";
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 消息列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param page
|
| | |
| | | params = JSONObject.fromObject(zhuShouMsg.getParams());
|
| | | }
|
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil.getWXMPJumDetail(zhuShouMsg.getJumpDetail());
|
| | | |
| | |
|
| | | if (Constant.IS_TEST)
|
| | | read = false;
|
| | | commonMsgList.add(new UserCommonMsgVO(zhuShouMsg.getIcon(), zhuShouMsg.getTitle(),
|
| | | zhuShouMsg.getUpdateTime(), UserCommonMsgVO.TYPE_ZHUSHOU, zhuShouMsg.getContent(), read,
|
| | | wxmpJumDetail, zhuShouMsg.getParams(), 0));
|
| | | |
| | | |
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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()));
|
| | | |
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil.getWXMPJumDetail(jumpDetailV2Service.getByTypeCache("order_search"));
|
| | | |
| | |
|
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil
|
| | | .getWXMPJumDetail(jumpDetailV2Service.getByTypeCache("order_search"));
|
| | |
|
| | | UserMsgVO userMsgVO = UserMsgVOFactory.create(detail, wxmpJumDetail, params);
|
| | | userMsgVO.setType(MSG_TYPE_ORDER);
|
| | | list.add(userMsgVO);
|
| | |
| | | UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
|
| | | UserSystemMsg usm = userSystemMsgService.getLatestUserSystemMsg(uid);
|
| | | if (usm != null) {
|
| | | UserSystemMsgVO userSystemMsgVO = new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), "系统消息", usm.getTitle(),
|
| | | UserSystemMsgVO userSystemMsgVO = 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());
|
| | | |
| | | // TODO 跳转地址 |
| | |
|
| | | // TODO 跳转地址
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", "http://apph5.banliapp.com/special/1.0.9/jingXuanN_9.html?type=9_9");
|
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil.getWXMPJumDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | userSystemMsgVO.setJumpDetail(wxmpJumDetail);
|
| | | |
| | |
|
| | | root.put("systemMsg", userSystemMsgVO);
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | | |
| | |
|
| | | private String getTimeDesc(Date nowDate, Date targetDate) {
|
| | | Calendar now = Calendar.getInstance();
|
| | | now.setTime(nowDate);
|
| | |
| | | return TimeUtil.getGernalTime(targetDate.getTime(), "yyyy.MM.dd HH:mm");
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | private GsonBuilder getTimeDescJsonBuilder(GsonBuilder builder) {
|
| | | builder = builder.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | |
| | |
|
| | | return builder;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 消息未读清理
|
| | | * 消息未读清理
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | |
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getUnReadMsgCount", method = RequestMethod.POST)
|
| | | public void getUnReadMsgCount(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | if (uid == null) {
|
| | | data.put("totalCount", 0);
|
| | | } else {
|
| | | UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
|
| | | int totalCount = num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
|
| | | + num.getTypeScore() + num.getTypeSystem() + num.getTypeOther();
|
| | | data.put("totalCount", totalCount >= 100 ? "99+" : totalCount + "");
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | }
|