yujian
2019-03-12 4a05f1c9c508ab7f10c5eae22a5c716f5454ca02
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -219,9 +219,30 @@
         return;
      }
      UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
      JSONObject data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
      data.put("totalCount", num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
            + num.getTypeScore() + num.getTypeSystem() + num.getTypeOther());
      GsonBuilder androidBuilder = new GsonBuilder().registerTypeAdapter(Integer.class,
            new JsonSerializer<Integer>() {
               @Override
               public JsonElement serialize(Integer value, Type theType, JsonSerializationContext context) {
                  if (value == null) {
                     return new JsonPrimitive("0");
                  } else {
                     if (value >= 100)
                        return new JsonPrimitive("99+");
                     else
                        return new JsonPrimitive(value);
                  }
               }
            });
      int totalCount = num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
            + num.getTypeScore() + num.getTypeSystem() + num.getTypeOther();
      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", totalCount);
      try {
         UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);