yujian
2020-06-11 17f45fe20aeaa233bce56c6d5287265aa8613aad
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCloudControllerV2.java
@@ -8,8 +8,6 @@
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -398,7 +396,7 @@
    * @param out
    */
   @RequestMapping(value = "switchCircleState")
   public void switchCircleState(String callback, AcceptData acceptData, Long uid, Boolean state, PrintWriter out) {
   public void switchCircleState(String callback, AcceptData acceptData, Long uid, Integer state, PrintWriter out) {
      if (uid == null) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户未登录"));
         return;
@@ -407,8 +405,14 @@
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "状态不能为空"));
         return;
      }
      boolean reslut = false;
      if (state == 1) {
         reslut = true;
      }
      try {
         userCloudGroupService.switchCircleState(uid, state);
         userCloudGroupService.switchCircleState(uid, reslut);
      } catch (UserCloudGroupException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      }
@@ -457,7 +461,7 @@
    * @param out
    */
   @RequestMapping(value = "switchGroupState")
   public void switchGroupState(String callback, AcceptData acceptData, Long uid, Long id, Boolean state,
   public void switchGroupState(String callback, AcceptData acceptData, Long uid, Long id, Integer state,
         PrintWriter out) {
      if (uid == null) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户未登录"));
@@ -467,8 +471,14 @@
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "参数不能为空"));
         return;
      }
      boolean reslut = false;
      if (state == 1) {
         reslut = true;
      }
      try {
         userCloudGroupService.switchGroupState(uid, id, state);
         userCloudGroupService.switchGroupState(uid, id, reslut);
      } catch (UserCloudGroupException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      }
@@ -502,27 +512,6 @@
      JSONArray array = new JSONArray();
      JSONObject data = new JSONObject();
      if (list.size() > 0) {
         List<Long> listGid = new ArrayList<Long>();
         for (UserCloudGoods cloudGoods : list) {
            CommonGoods commonGoods = cloudGoods.getCommonGoods();
            if (commonGoods == null) {
               continue;
            }
            listGid.add(commonGoods.getGoodsId());
         }
         // API网络接口验证是否在售
         List<TaoBaoGoodsBrief> listTaoKeGoods = null;
         try {
            listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
         } catch (TaoKeApiException e) {
            e.printStackTrace();
         } catch (TaobaoGoodsDownException e) {
            e.printStackTrace();
         } catch (Exception e) {
            e.printStackTrace();
         }
         Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
               .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
         ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
@@ -532,22 +521,6 @@
            CommonGoods commonGoods = cloudGoods.getCommonGoods();
            if (commonGoods == null) {
               continue;
            }
            // 淘宝商品验证在售
            if (commonGoods.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
               if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) {
                  int state = 1; // 默认停售
                  Long goodsId = commonGoods.getGoodsId();
                  for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) {
                     Long auctionId = taoKeGoods.getAuctionId();
                     if (goodsId == auctionId || goodsId.equals(auctionId)) {
                        state = 0; // 在售
                        break;
                     }
                  }
                  commonGoods.setState(state);
               }
            }
            // 判断是否已分享, 已分享显示已下架
@@ -674,9 +647,7 @@
         key = StringUtil.Md5(key);
         redisManager.cacheCommonString(key , builder.toString() , 60*10);
         
         System.out.println(builder.toString());
         String link = "http://192.168.1.200:8008/fanli/client/v1/cloud/callback/payUrl?key=%s";
         String link = configService.get(ConfigKeyEnum.cloudAlipayNotifyLink.getKey()) +"?key=%s";
         JSONObject dataObject = new JSONObject();
         dataObject.put("link", String.format(link, key));
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(dataObject));