From df1e2d997ac152a7122ccb7a079d2c0debb173c2 Mon Sep 17 00:00:00 2001 From: admin <2780501319@qq.com> Date: 星期二, 18 二月 2020 12:47:57 +0800 Subject: [PATCH] 小程序相关接口bug修改 --- fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/OrderController.java | 101 ++++++++++++++++++++++++-------------------------- 1 files changed, 48 insertions(+), 53 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/OrderController.java b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/OrderController.java index fbd6477..8f9dacf 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/OrderController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/OrderController.java @@ -50,10 +50,10 @@ @Resource private UserCustomSettingsService userCustomSettingsService; - + @Resource private HongBaoV2CountService hongBaoV2CountService; - + @Resource private CommonOrderService commonOrderService; @@ -68,7 +68,7 @@ @Resource private RedisManager redisManager; - + @Resource private ESOrderService esOrderService; @@ -98,7 +98,7 @@ List<Integer> listSource = new ArrayList<>(); listSource.add(Constant.SOURCE_TYPE_JD); listSource.add(Constant.SOURCE_TYPE_PDD); - + // 楠岃瘉鏄惁鏄剧ず妯″潡 if (settings != null && settings.getNoBonusCount() != null) { if (settings.getNoBonusCount() == 1) { @@ -121,10 +121,7 @@ data.put("inviteMoney", inviteMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); out.print(JsonUtil.loadTrueResult(data)); } - - - /** * 璁㈠崟鍒楄〃 * @@ -147,28 +144,28 @@ * 鏃堕棿娈碉細1-鏈�杩戜笁澶� 2-鏈�杩戜竷澶� 3鏈�杩戝崐鏈� 4鏈湀 5杩戜笁鏈� 6杩戝崐骞� * @param dateType * 1-浠婃棩 2-鏄ㄥぉ 3-鏈湀 4-涓婁釜鏈� | - * @param source - * 椤甸潰鏉ユ簮锛歸elfareCore-绂忓埄涓績銆乥onus -濂栭噾缁熻锛堟垜鐨勭晫闈級 + * @param source + * 椤甸潰鏉ユ簮锛歸elfareCore-绂忓埄涓績銆乥onus -濂栭噾缁熻锛堟垜鐨勭晫闈級 * @param out */ @RequestMapping(value = "getOrderList", method = RequestMethod.POST) - public void getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, String type, - Integer orderState, String orderNo, String startTime, String endTime, Integer slotTime, - Integer dateType, Integer goodsType, String source, PrintWriter out) { + public void getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, String type, + Integer orderState, String orderNo, String startTime, String endTime, Integer slotTime, Integer dateType, + Integer goodsType, String source, PrintWriter out) { if (uid == null) { out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); return; } - + if (page == null || page < 1) page = 1; - + // 鎼滅储鍐呭銆佽鍗曞彿 if (!StringUtil.isNullOrEmpty(orderNo)) { searchOrder(orderNo, page, uid, out); return; } - + // 杞崲鐘舵�� if (state != null) { if (state == 0) { @@ -189,13 +186,13 @@ Integer orderType = null; if (StringUtil.isNullOrEmpty(type)) { orderType = null; - } else if (!"0".equalsIgnoreCase(type)){ - orderType = Integer.parseInt(type); - } + } else if (!"0".equalsIgnoreCase(type)) { + orderType = Integer.parseInt(type); + } if (goodsType != null && goodsType == 0) goodsType = null; - + // 绛涢�夋椂闂� if (slotTime != null) { try { @@ -229,7 +226,7 @@ e.printStackTrace(); } } - + if (endTime != null && endTime.trim().length() > 0) { endTime += " 23:59:59"; } @@ -241,9 +238,7 @@ listSource.add(Constant.SOURCE_TYPE_JD); listSource.add(Constant.SOURCE_TYPE_PDD); } - - - + try { // 绛涢�夌粨鏋滈《閮ㄧ粺璁� String validMoney = "0.00"; @@ -251,14 +246,14 @@ if (page == 1) { BigDecimal predictMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 1, orderNo, state, startTime, endTime, listSource); - if (predictMoney != null) + if (predictMoney != null) validMoney = predictMoney.setScale(2, BigDecimal.ROUND_DOWN).toString(); - + BigDecimal postSaleMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 2, orderNo, state, startTime, endTime, listSource); - if (postSaleMoney != null) + if (postSaleMoney != null) invalidMoney = postSaleMoney.setScale(2, BigDecimal.ROUND_DOWN).toString(); - + if (orderType != null && dateType != null && dateType == 4) { if (orderType == 1) { dateType = 6; // 杩斿埄璁㈠崟鏈夋晥 @@ -267,22 +262,22 @@ } } } - - // 鏌ヨ鍒楄〃 - List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType, orderState, - orderNo, startTime, endTime, dateType, listSource); - // 缁熻鎬绘暟 - long count = commonOrderService.countGroupOrderNoByUid(uid, state, orderType, orderState, orderNo, startTime, - endTime, dateType, listSource); - // 鍒ゆ柇鏄惁闇�瑕佹樉绀鸿鍗曟壘鍥炴彁绀� 8绉掑唴璇锋眰3娆¤Е鍙� + // 鏌ヨ鍒楄〃 + List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType, + orderState, orderNo, startTime, endTime, dateType, listSource); + // 缁熻鎬绘暟 + long count = commonOrderService.countGroupOrderNoByUid(uid, state, orderType, orderState, orderNo, + startTime, endTime, dateType, listSource); + + // 鍒ゆ柇鏄惁闇�瑕佹樉绀鸿鍗曟壘鍥炴彁绀� 8绉掑唴璇锋眰3娆¤Е鍙� String orderFindUrl = null; - if (state ==null && page == 1) { - if (redisManager.frequencyLimit("orderlist-" + acceptData.getDevice(), 8, 4)||count==0L) { + if (state == null && page == 1) { + if (redisManager.frequencyLimit("orderlist-" + acceptData.getDevice(), 8, 4) || count == 0L) { orderFindUrl = configService.get(ConfigKeyEnum.orderFindNotifyUrl.getKey()); } } - + JSONObject data = new JSONObject(); data.put("count", count); data.put("list", JsonUtil.getApiCommonGson().toJson(list)); @@ -294,13 +289,17 @@ } catch (CommonOrderException e) { out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg())); } catch (Exception e) { - out.print(JsonUtil.loadFalseResult(1, "鏌ヨ澶辫触")); + if (Constant.IS_TEST) { + e.printStackTrace(out); + } else + out.print(JsonUtil.loadFalseResult(1, "鏌ヨ澶辫触")); LogHelper.errorDetailInfo(e); } } - + /** * 鎼滅储璁㈠崟 + * * @param key * @param out */ @@ -312,16 +311,16 @@ listSource.add(Constant.SOURCE_TYPE_JD); listSource.add(Constant.SOURCE_TYPE_PDD); List<ESOrder> listES = esOrderService.query(key, uid.toString(), listSource); - + if (listES.size() != 0) { list = commonOrderService.searchOrderByUid(page, Constant.PAGE_SIZE, uid, listES); count = commonOrderService.countSearchOrderByUid(uid, listES); } - + if (list == null) { list = new ArrayList<>(); } - + JSONObject data = new JSONObject(); data.put("count", count); data.put("list", JsonUtil.getApiCommonGson().toJson(list)); @@ -333,14 +332,12 @@ } } - /** * 鐢ㄦ埛璁㈠崟缁熻 * * @param acceptData * @param uid - * 鐢ㄦ埛id - * type 绫诲瀷锛�0鍏ㄩ儴銆�1娣樺疂 2浜笢銆佹嫾澶氬 + * 鐢ㄦ埛id type 绫诲瀷锛�0鍏ㄩ儴銆�1娣樺疂 2浜笢銆佹嫾澶氬 * @param out */ @RequestMapping(value = "getOrderCount", method = RequestMethod.POST) @@ -349,7 +346,7 @@ out.print(JsonUtil.loadFalseResult(1, "璇锋眰鍙傛暟涓嶆纭�")); return; } - + try { UserInfo user = userInfoService.selectByPKey(uid); if (user == null) { @@ -365,12 +362,12 @@ } JSONObject data = new JSONObject(); data.put("userInfo", userInfo); - + List<Integer> listSource = new ArrayList<>(); if (type == null || type == 0) { listSource.add(Constant.SOURCE_TYPE_JD); listSource.add(Constant.SOURCE_TYPE_PDD); - + OrderCountVO total = commonOrderService.getOrderCount(uid, null, listSource); data.put("total", total.getSelf() + total.getShared() + total.getInvite()); data.put("self", total.getSelf()); @@ -383,7 +380,7 @@ data.put("invite", 0); listSource.add(type); } - + // 浠婂ぉ OrderCountVO today = commonOrderService.getOrderCount(uid, 1, listSource); today.setTotal(today.getSelf() + today.getShared() + today.getInvite()); @@ -407,7 +404,5 @@ e.printStackTrace(); } } - + } - - -- Gitblit v1.8.0