| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | 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.msg.MsgOtherDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
|
| | | import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.goods.RecommendUserGoods;
|
| | |
| | | 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.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.VersionUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory;
|
| | | import com.yeshi.fanli.util.factory.msg.UserMsgVOFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
| | | @Resource
|
| | | private MsgDeviceReadStateService msgDeviceReadStateService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | // 消息的类型
|
| | | final static String MSG_TYPE_ORDER = "order";
|
| | | final static String MSG_TYPE_MONEY = "money";
|
| | |
| | | List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
|
| | | count = msgOrderDetailService.countMsgOrderDetail(uid);
|
| | | if (detailList != null)
|
| | | for (MsgOrderDetail detail : detailList)
|
| | | list.add(UserMsgVOFactory.create(detail));
|
| | | for (MsgOrderDetail detail : detailList) {
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("orderNo", detail.getOrderId());
|
| | | if (detail.getType() == MsgTypeOrderTypeEnum.share
|
| | | || detail.getType() == MsgTypeOrderTypeEnum.invite)
|
| | | params.put("orderHideNo", UserUtil.filterOrderId(detail.getOrderId()));
|
| | | list.add(UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"),
|
| | | params));
|
| | | }
|
| | | break;
|
| | | case MSG_TYPE_MONEY:
|
| | | userMsgReadStateService.readMoneyMsg(uid);
|
| | |
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "#acceptData.device")
|
| | | @RequestMapping(value = "getUnReadMsgCount", method = RequestMethod.POST)
|
| | | public void getUnReadMsgCount(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | GsonBuilder androidBuilder = new GsonBuilder().registerTypeAdapter(Integer.class,
|
| | |
| | | data.put("totalCount", 0);
|
| | | }
|
| | | } catch (UserCustomSettingsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | int totalCount = msgDeviceReadStateService.getUnReadCount(acceptData.getDevice(),
|
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, MsgDeviceReadState.TYPE_KEFU);
|
| | | data.put("totalCount", totalCount);
|
| | | }
|
| | | data.put("mineCount", 0);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
| | | int totalCount = num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
|
| | | + num.getTypeScore() + num.getTypeSystem() + num.getTypeOther();
|
| | |
|
| | | // 1.5.50及以后的版本需要添加设备未读消息
|
| | | if (VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | totalCount += msgDeviceReadStateService.getUnReadCount(acceptData.getDevice(),
|
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, MsgDeviceReadState.TYPE_KEFU);
|
| | | }
|
| | |
|
| | | JSONObject data = null;
|
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | data = JSONObject.fromObject(androidBuilder.excludeFieldsWithoutExposeAnnotation().create().toJson(num));
|
| | |
| | | data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
|
| | | }
|
| | | data.put("totalCount", totalCount);
|
| | | // "我的"选项角标
|
| | | int welfareCenterNews = 0;
|
| | | if (uid != null) {
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | if (userInfoExtra.getCouponNews() != null) {
|
| | | welfareCenterNews = userInfoExtra.getCouponNews();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | data.put("mineCount", welfareCenterNews);
|
| | |
|
| | | try {
|
| | | UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
|
| | |
| | | public void getHomeMsgList(AcceptData acceptData, Long uid, int page, HttpSession session, PrintWriter out) {
|
| | | if (uid != null && uid == 0)
|
| | | uid = null;
|
| | | if (uid != null)
|
| | | userSystemMsgService.syncSystemZNX(uid);
|
| | |
|
| | | String device = acceptData.getDevice();
|
| | | if (device == null || device.trim().length() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("设备号不能为空"));
|
| | |
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | | private UserCommonMsgVO getKeFuMsg(AcceptData acceptData) {
|
| | | MsgDeviceReadState kefuState = msgDeviceReadStateService.getByDeviceAndPlatformAndType(
|
| | | UserCommonMsgVO.TYPE_KEFU, acceptData.getDevice(),
|
| | | acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
|
| | | // 人工客服
|
| | | UserCommonMsgVO vo = new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_kefu.png", "人工客服", new Date(),
|
| | | UserCommonMsgVO.TYPE_KEFU, "", false, null, null, 0);
|
| | | if (kefuState != null) {
|
| | | vo.setUnReadCount(kefuState.getUnReadCount() == null ? 0 : kefuState.getUnReadCount());
|
| | | if (!StringUtil.isNullOrEmpty(kefuState.getLatestContent()))
|
| | | vo.setLatestMsg(kefuState.getLatestContent());
|
| | |
|
| | | if (vo.getUnReadCount() != null && vo.getUnReadCount() > 0)
|
| | | vo.setRead(false);
|
| | | else
|
| | | vo.setRead(true);
|
| | |
|
| | | if (kefuState.getLatestContentTime() != null)
|
| | | vo.setTime(kefuState.getLatestContentTime());
|
| | |
|
| | | } else
|
| | | vo.setRead(true);
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(vo.getLatestMsg()))
|
| | | vo.setLatestMsg("[点击打开人工客服]");
|
| | |
|
| | | return vo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取消息列表
|
| | | *
|
| | |
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "#acceptData.device")
|
| | | @RequestMapping(value = "getHomeMsgListNew", method = RequestMethod.POST)
|
| | | public void getHomeMsgListNew(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid != null && uid == 0)
|
| | | uid = null;
|
| | | if (uid != null) {
|
| | | userSystemMsgService.syncSystemZNX(uid);
|
| | | }
|
| | |
|
| | | List<UserMsgCenter> listCenter = new ArrayList<>();
|
| | |
|
| | |
| | | // 官宣任务
|
| | | if (uid != null) {
|
| | | MsgCommonDTO guanXuanMsg = msgConfigService.getGuanXuanMsg();
|
| | | if (guanXuanMsg != null) {
|
| | | if (guanXuanMsg != null && guanXuanMsg.getShow() == true) {
|
| | | boolean read = false;
|
| | | UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
|
| | | if (num != null && (num.getGuanXuanReadTime() != null
|
| | |
| | | } else
|
| | | commonMsgList.add(new UserCommonMsgVO(guanXuanMsg.getIcon(), guanXuanMsg.getTitle(),
|
| | | guanXuanMsg.getUpdateTime(), UserCommonMsgVO.TYPE_GUANXUAN, guanXuanMsg.getContent(), read,
|
| | | guanXuanMsg.getJumpDetail(), guanXuanMsg.getParams()));
|
| | | guanXuanMsg.getJumpDetail(), guanXuanMsg.getParams(), 0));
|
| | | }
|
| | | }
|
| | |
|
| | | // 返利券小助手
|
| | | MsgCommonDTO zhuShouMsg = msgConfigService.getZhuShouMsg();
|
| | | if (zhuShouMsg != null) {
|
| | |
|
| | | if (zhuShouMsg != null && zhuShouMsg.getShow() == true) {
|
| | | boolean read = false;
|
| | |
|
| | | MsgDeviceReadState state = msgDeviceReadStateService.getByDeviceAndPlatformAndType(
|
| | | UserCommonMsgVO.TYPE_ZHUSHOU, acceptData.getDevice(),
|
| | | acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
|
| | |
| | | } else
|
| | | commonMsgList.add(new UserCommonMsgVO(zhuShouMsg.getIcon(), zhuShouMsg.getTitle(),
|
| | | zhuShouMsg.getUpdateTime(), UserCommonMsgVO.TYPE_ZHUSHOU, zhuShouMsg.getContent(), read,
|
| | | zhuShouMsg.getJumpDetail(), zhuShouMsg.getParams()));
|
| | | zhuShouMsg.getJumpDetail(), zhuShouMsg.getParams(), 0));
|
| | | }
|
| | |
|
| | | // 人工客服
|
| | | commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_kefu.png", "人工客服", new Date(),
|
| | | UserCommonMsgVO.TYPE_KEFU, "", false, null, null));
|
| | | commonMsgList.add(getKeFuMsg(acceptData));
|
| | |
|
| | | // 推荐记录
|
| | | DeviceActive deviceActive = deviceActiveService.getDeviceByDeviceAndPlatform(acceptData.getDevice(),
|
| | |
| | | acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
|
| | | boolean read = false;
|
| | | if (state != null && state.getReadTime() != null
|
| | | && list.get(0).getCreateTime().getTime() < state.getReadTime().getTime())
|
| | | && list.get(0).getPushTime().getTime() < state.getReadTime().getTime())
|
| | | read = true;
|
| | |
|
| | | commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_recommend.png", "推荐记录",
|
| | | list.get(0).getCreateTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), read,
|
| | | jumpDetailV2Service.getByTypeCache("recommend_list"), null));
|
| | | list.get(0).getPushTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), read,
|
| | | jumpDetailV2Service.getByTypeCache("recommend_list"), null, 0));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
|
| | | if (detailList != null && detailList.size() > 0) {
|
| | | for (MsgOrderDetail detail : detailList) {
|
| | | UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("orderNo", detail.getOrderId());
|
| | | if (detail.getType() == MsgTypeOrderTypeEnum.share
|
| | | || detail.getType() == MsgTypeOrderTypeEnum.invite)
|
| | | params.put("orderHideNo", UserUtil.filterOrderId(detail.getOrderId()));
|
| | | UserMsgVO userMsgVO = UserMsgVOFactory.create(detail,
|
| | | jumpDetailV2Service.getByTypeCache("order_search"), params);
|
| | | userMsgVO.setType(MSG_TYPE_ORDER);
|
| | | list.add(userMsgVO);
|
| | | }
|
| | |
| | | "http://img.flqapp.com/resource/msg/icon_msg_system.png",
|
| | | getTimeDesc(new Date(), usm.getCreateTime()), num.getTypeSystem()));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 提醒大图
|
| | | */
|
| | | 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));
|
| | | }
|
| | |
|
| | | root.put("list", builder.create().toJson(listCenter));
|
| | |
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 上传最近的客服消息
|
| | | * |
| | | * @param acceptData
|
| | | * @param content
|
| | | * @param time
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "uploadLatestKeFuMsg", method = RequestMethod.POST)
|
| | | public void uploadLatestKeFuMsg(AcceptData acceptData, String content, Long datetime, PrintWriter out) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(content) || datetime == null) {
|
| | | out.print(JsonUtil.loadFalseResult("参数不完整"));
|
| | | return;
|
| | | }
|
| | | msgDeviceReadStateService.addUnreadDeviceMsg(MsgDeviceReadState.TYPE_KEFU, acceptData.getDevice(),
|
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, 0, content, new Date(datetime));
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | }
|