| | |
| | | */
|
| | | @RequestMapping(value = "getUnReadMsgCount", method = RequestMethod.POST)
|
| | | public void getUnReadMsgCount(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
|
| | |
|
| | | int deviceCount = msgDeviceReadStateService.getUnReadCount(acceptData.getDevice(),
|
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2);
|
| | | GsonBuilder androidBuilder = new GsonBuilder().registerTypeAdapter(Integer.class,
|
| | | new JsonSerializer<Integer>() {
|
| | | @Override
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | if (uid == null) {
|
| | | // 如果用户未登录就读取设备消息
|
| | | UserMsgUnReadNum num = new UserMsgUnReadNum();
|
| | | num.setTypeAccount(0);
|
| | | num.setTypeInvite(0);
|
| | | num.setTypeMoney(0);
|
| | | num.setTypeOrder(0);
|
| | | num.setTypeOther(0);
|
| | | num.setTypeScore(0);
|
| | | num.setTypeSystem(0);
|
| | | JSONObject data = null;
|
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | data = JSONObject
|
| | | .fromObject(androidBuilder.excludeFieldsWithoutExposeAnnotation().create().toJson(num));
|
| | | } else {
|
| | | data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
|
| | | }
|
| | | data.put("totalCount", deviceCount);
|
| | |
|
| | | try {
|
| | | UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
|
| | | if (vo != null && vo.getNoNewsRedDot() != null && vo.getNoNewsRedDot() == 1) {
|
| | | data.put("totalCount", 0);
|
| | | }
|
| | | } catch (UserCustomSettingsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
|
| | |
|
| | | int totalCount = num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
|
| | | + num.getTypeScore() + num.getTypeSystem() + num.getTypeOther();
|
| | | + num.getTypeScore() + num.getTypeSystem() + num.getTypeOther() + deviceCount;
|
| | |
|
| | | JSONObject data = null;
|
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | data = JSONObject.fromObject(androidBuilder.excludeFieldsWithoutExposeAnnotation().create().toJson(num));
|
| | |
| | | List<UserMsgCenter> listCenter = new ArrayList<>();
|
| | |
|
| | | // 单条消息
|
| | | List<UserCommonMsgVO> commonMsgList = new ArrayList<>(); |
| | | List<UserCommonMsgVO> commonMsgList = new ArrayList<>();
|
| | |
|
| | | long currentTime = System.currentTimeMillis();
|
| | | |
| | |
|
| | | // 官宣任务
|
| | | if (uid != null) {
|
| | |
| | | guanXuanMsg.getJumpDetail(), guanXuanMsg.getParams()));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | // 返利券小助手
|
| | | MsgCommonDTO zhuShouMsg = msgConfigService.getZhuShouMsg();
|
| | | if (zhuShouMsg != null) {
|
| | |
| | | zhuShouMsg.getUpdateTime(), UserCommonMsgVO.TYPE_ZHUSHOU, zhuShouMsg.getContent(), read,
|
| | | zhuShouMsg.getJumpDetail(), zhuShouMsg.getParams()));
|
| | | }
|
| | | |
| | | //人工客服
|
| | |
|
| | | // 人工客服
|
| | | commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_kefu.png", "人工客服", new Date(),
|
| | | UserCommonMsgVO.TYPE_KEFU, "", false, null, null));
|
| | | |
| | |
|
| | | // 推荐记录
|
| | | DeviceActive deviceActive = deviceActiveService.getDeviceByDeviceAndPlatform(acceptData.getDevice(),
|
| | | acceptData.getDevice(), acceptData.getPlatform());
|