yujian
2019-08-16 8e631ceb2c08e6cd00e68b1aa9ad1fec7cea6a72
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
@@ -43,6 +43,7 @@
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.StringUtil;
import com.yeshi.fanli.vo.integral.DailySignVO;
import com.yeshi.fanli.vo.integral.ExchangeTipVO;
import com.yeshi.fanli.vo.integral.IntegralTaskClassVO;
@@ -80,6 +81,7 @@
   
   /**
    * 获取任务列表
    *
    * @param acceptData
    * @param uid
    * @param page
@@ -101,7 +103,8 @@
      Gson gson = gsonBuilder.create();
      try {
         JSONObject data = new JSONObject();
         List<IntegralTaskClassVO> list = integralTaskClassService.getIntegralTaskClassVO(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
         List<IntegralTaskClassVO> list = integralTaskClassService.getIntegralTaskClassVO(uid,
               (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
         if (list == null) {
            list = new ArrayList<IntegralTaskClassVO>();
         }
@@ -148,9 +151,9 @@
      }
   }
   
   /**
    * 获取已完成任务 未领取金币
    *
    * @param acceptData
    * @param uid
    * @param out
@@ -175,9 +178,9 @@
      out.print(JsonUtil.loadTrueResult(data));
   }
   /**
    * 领取金币
    *
    * @param acceptData
    * @param uid
    * @param ids
@@ -191,7 +194,8 @@
      }
      
      Gson gson = new Gson();
      Set<Long> idList = gson.fromJson(ids, new TypeToken<HashSet<Long>>() {}.getType());
      Set<Long> idList = gson.fromJson(ids, new TypeToken<HashSet<Long>>() {
      }.getType());
      if (idList == null || idList.size() == 0) {
         out.print(JsonUtil.loadFalseResult("领取id不能为空"));
         return;
@@ -207,9 +211,9 @@
      }
   }
   
   /**
    *  金币兑换列表
    *
    * @param acceptData
    * @param uid
    * @param ids
@@ -252,6 +256,7 @@
   
   /**
    * 兑换金币检验
    *
    * @param acceptData
    * @param uid
    * @param id
@@ -275,6 +280,7 @@
   
   /**
    * 兑换金币
    *
    * @param acceptData
    * @param uid
    * @param id
@@ -296,9 +302,9 @@
      }
   }
   
   /**
    * 兑换金币检验-邀请码
    *
    * @param acceptData
    * @param uid
    * @param id
@@ -320,9 +326,9 @@
      }
   }
   
   /**
    * 兑换金币-邀请码
    *
    * @param acceptData
    * @param uid
    * @param id
@@ -338,10 +344,9 @@
      }
   }
   
   /**
    * 邀请码发布列表
    *
    * @param acceptData
    * @param page
    * @param out
@@ -353,7 +358,8 @@
         return;
      }
      
      List<CodePublishRecord> list = codePublishRecordService.listValid((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
      List<CodePublishRecord> list = codePublishRecordService.listValid((page - 1) * Constant.PAGE_SIZE,
            Constant.PAGE_SIZE);
      if (list == null) {
         list = new ArrayList<CodePublishRecord>();
      }   
@@ -367,10 +373,54 @@
      out.print(JsonUtil.loadTrueResult(data));
   }
   
   /**
    * 事件推送
    *
    * @param acceptData
    * @param event
    * @param uid
    * @param out
    */
   @RequestMapping(value = "pushEvent", method = RequestMethod.POST)
   public void pushEvent(AcceptData acceptData, String event, Long uid, PrintWriter out) {
      if (uid == null || uid == 0) {
         out.print(JsonUtil.loadFalseResult("用户尚未登录"));
         return;
      }
   
      if (StringUtil.isNullOrEmpty(event)) {
         out.print(JsonUtil.loadFalseResult("事件为空"));
         return;
      }
      JSONObject data = new JSONObject();
      if ("recommendSearch".equalsIgnoreCase(event) || "scanGoods".equalsIgnoreCase(event)
            || "scanTBCart".equalsIgnoreCase(event)) {
         JSONObject notify = new JSONObject();
         switch (event) {
         case "recommendSearch":
            notify.put("name", "完成一次智能搜索");
            notify.put("score", "+20");
            break;
         case "scanGoods":
            notify.put("name", "完成一次商品浏览");
            notify.put("score", "+10");
            break;
         case "scanTBCart":
            notify.put("name", "完成一次购物车浏览");
            notify.put("score", "+30");
            break;
         }
         data.put("notify", notify);
      }
      out.print(JsonUtil.loadTrueResult(data));
   }
   /**
    * 时间处理
    *
    * @return
    */
   private Gson getGson() {
@@ -433,8 +483,5 @@
      Gson gson = gb.create();
      return gson;
   }
   
}