yujian
2020-01-18 f4a0f2acc63d7785eab108419a4e16f5f688cb95
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
@@ -39,6 +39,7 @@
import com.yeshi.fanli.entity.integral.IntegralTask.TaskUniqueKeyEnum;
import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum;
import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.exception.integral.IntegralExchangeException;
import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
import com.yeshi.fanli.log.LogHelper;
@@ -344,7 +345,7 @@
         JSONObject data = new JSONObject();
         data.put("goldCoin", goldCoin);
         out.print(JsonUtil.loadTrueResult(data));
      } catch (IntegralTaskRecordException e) {
      } catch (IntegralTaskRecordException e) {
         out.print(JsonUtil.loadFalseResult(e.getMsg()));
      }
   }
@@ -392,6 +393,28 @@
      out.print(JsonUtil.loadTrueResult(data));
   }
   @RequestMapping(value = "getExchangeDetail")
   public void getExchangeDetail(AcceptData acceptData, Long id, String callback, PrintWriter out) {
      if (id == null || id <= 0) {
         out.print(JsonUtil.loadFalseResult(1, "兑换ID有误"));
         return;
      }
      IntegralExchange exchange = integralExchangeService.selectByPrimaryKey(id);
      if (exchange != null) {
         GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
         Gson gson = gsonBuilder.create();
         if (StringUtil.isNullOrEmpty(callback))
            out.print(JsonUtil.loadTrueResult(gson.toJson(exchange)));
         else
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(gson.toJson(exchange))));
      } else {
         if (StringUtil.isNullOrEmpty(callback))
            out.print(JsonUtil.loadFalseResult("未找到"));
         else
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未找到")));
      }
   }
   /**
    * 兑换金币检验
    * 
@@ -400,8 +423,8 @@
    * @param id
    * @param out
    */
   @RequestMapping(value = "verifyExchange", method = RequestMethod.POST)
   public void verifyExchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
   @RequestMapping(value = "verifyExchange")
   public void verifyExchange(AcceptData acceptData, Long uid, Long id, String callback, PrintWriter out) {
      try {
         ExchangeTipVO exchange = integralExchangeService.verifyExchange(uid, id);
@@ -409,9 +432,17 @@
         Gson gson = gsonBuilder.create();
         JSONObject data = new JSONObject();
         data.put("result", gson.toJson(exchange));
         out.print(JsonUtil.loadTrueResult(data));
         if (StringUtil.isNullOrEmpty(callback)) {
            out.print(JsonUtil.loadTrueResult(data));
         } else {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
         }
      } catch (IntegralExchangeException e) {
         out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
         if (StringUtil.isNullOrEmpty(callback)) {
            out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
         } else {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, e.getMsg())));
         }
      }
   }
@@ -424,8 +455,8 @@
    * @param out
    */
   @RequestSerializableByKey(key = "'integralexchange-'+#uid")
   @RequestMapping(value = "exchange", method = RequestMethod.POST)
   public void exchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
   @RequestMapping(value = "exchange")
   public void exchange(AcceptData acceptData, Long uid, Long id, String callback, PrintWriter out) {
      try {
         IntegralExchange exchange = integralExchangeService.exchange(uid, id);
@@ -437,9 +468,15 @@
         JSONObject data = new JSONObject();
         data.put("result", gson.toJson(exchange));
         data.put("goldCoin", extraVO.getGoldCoin() + "枚");
         out.print(JsonUtil.loadTrueResult(data));
         if (StringUtil.isNullOrEmpty(callback))
            out.print(JsonUtil.loadTrueResult(data));
         else
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
      } catch (IntegralExchangeException e) {
         out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
         if (StringUtil.isNullOrEmpty(callback))
            out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
         else
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, e.getMsg())));
      }
   }
@@ -504,7 +541,7 @@
      }
      try {
         List<CodePublishRecord> list = codePublishRecordService.listValid((page - 1) * Constant.PAGE_SIZE,
         List<CodePublishRecord> list = codePublishRecordService.listValid(null, (page - 1) * Constant.PAGE_SIZE,
               Constant.PAGE_SIZE);
         if (list == null) {
            list = new ArrayList<CodePublishRecord>();
@@ -515,7 +552,7 @@
         JSONObject data = new JSONObject();
         data.put("count", count);
         data.put("list", getGson().toJson(list));
         data.put("helpLink", configService.get("publish_list_help_link"));
         data.put("helpLink", configService.get(ConfigKeyEnum.publishListHelpLink.getKey()));
         out.print(JsonUtil.loadTrueResult(data));
      } catch (Exception e) {
         out.print(JsonUtil.loadFalseResult(1, "获取失败"));