From 17f45fe20aeaa233bce56c6d5287265aa8613aad Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期四, 11 六月 2020 14:36:26 +0800 Subject: [PATCH] 状态切换 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCloudControllerV2.java | 63 ++++++++----------------------- 1 files changed, 17 insertions(+), 46 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCloudControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCloudControllerV2.java index 3ced83e..6fa5452 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCloudControllerV2.java +++ b/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)); -- Gitblit v1.8.0