From dc5be7d38446f70e6ff86df311119c32b41fe7f8 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 28 十一月 2020 16:37:05 +0800 Subject: [PATCH] 大淘客搜索接口升级 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java | 181 +++++++++++++++++++++++---------------------- 1 files changed, 93 insertions(+), 88 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java index 690f38e..cfb7db0 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java @@ -25,6 +25,7 @@ import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; +import com.yeshi.fanli.dto.order.SearchFilterOrder; import com.yeshi.fanli.dto.order.UserTeamLevel; import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.user.HongBaoV2; @@ -54,7 +55,6 @@ import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService; import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; import com.yeshi.fanli.service.inter.order.UserOrderWeiQuanRecordService; -import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderService; import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderUserMapService; import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService; import com.yeshi.fanli.service.inter.user.PreviewInfoService; @@ -63,14 +63,12 @@ import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService; import com.yeshi.fanli.service.inter.user.invite.ThreeSaleDetailService; -import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; import com.yeshi.fanli.service.inter.user.invite.UserInviteService; -import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.MoneyBigDecimalUtil; +import org.yeshi.utils.MoneyBigDecimalUtil; import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.StringUtil; -import com.yeshi.fanli.util.TimeUtil; +import org.yeshi.utils.TimeUtil; import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.account.UserUtil; import com.yeshi.fanli.util.user.UserLevelUtil; @@ -115,9 +113,6 @@ private ESOrderService esOrderService; @Resource - private UserVIPInfoService userVIPInfoService; - - @Resource private HongBaoV2Service hongBaoV2Service; @Resource @@ -142,16 +137,11 @@ private UserInviteService userInviteService; @Resource - private ThreeSaleSerivce threeSaleSerivce; - - @Resource private OrderHongBaoMapService orderHongBaoMapService; @Resource private PreviewInfoService previewInfoService; - @Resource - private TeamDividentsSourceOrderService teamDividentsSourceOrderService; @Resource private TeamDividentsSourceOrderUserMapService teamDividentsSourceOrderUserMapService; @@ -163,51 +153,36 @@ private ThreeSaleDetailService threeSaleDetailService; /** - * 璁㈠崟鍒楄〃 + * 澶勭悊鎼滅储鏉′欢 * - * @param acceptData - * @param page - * @param uid - * @param state - * 鐘舵�侊細0鍏ㄩ儴 1-鏈埌璐� 2-宸插埌璐� 3-宸插け鏁� 4宸叉敹璐� - * @param type - * 绫诲瀷锛�1-杩斿埄璁㈠崟 2-鍒嗕韩璁㈠崟 3-閭�璇疯鍗� - * @param orderState - * 1鏈夋晥璁㈠崟 2 缁存潈璁㈠崟 3澶辨晥璁㈠崟 - * @param orderNo - * 璁㈠崟鍙� - * @param startTime - * 璧峰鏃堕棿 - * @param endTime - * 缁撴潫鏃堕棿 - * @param slotTime - * 鏃堕棿娈碉細1-鏈�杩戜笁澶� 2-鏈�杩戜竷澶� 3鏈�杩戝崐鏈� 4鏈湀 5杩戜笁鏈� 6杩戝崐骞� - * @param dateType - * 1-浠婃棩 2-鏄ㄥぉ 3-鏈湀 4-涓婁釜鏈� | - * @param source - * 椤甸潰鏉ユ簮锛歸elfareCore-绂忓埄涓績銆乥onus -濂栭噾缁熻锛堟垜鐨勭晫闈級 - * @param out + * @param filter */ - @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) { - if (uid == null) { - out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); - return; + private void handleSearchFilter(SearchFilterOrder filter) { + Integer goodsType = filter.getGoodsType(); + if (goodsType != null && goodsType == 0) { + goodsType = null; + filter.setGoodsType(goodsType); } - if (page == null || page < 1) - page = 1; - - // 鎼滅储鍐呭銆佽鍗曞彿 - if (!StringUtil.isNullOrEmpty(orderNo) - && VersionUtil.greaterThan_2_0_6(acceptData.getPlatform(), acceptData.getVersion())) { - searchOrder(acceptData, orderNo, page, uid, out); - return; + List<Integer> listSource = new ArrayList<>(); + if (goodsType != null) { + listSource.add(goodsType); } + filter.setListSource(listSource); + + // 璁㈠崟绫诲瀷 + String type = filter.getType(); + Integer orderType = null; + if (StringUtil.isNullOrEmpty(type)) { + orderType = null; + } else if (!"0".equalsIgnoreCase(type)) { + orderType = Integer.parseInt(type); + } + filter.setOrderType(orderType); // 杞崲鐘舵�� + Integer orderState = filter.getOrderState(); + Integer state = filter.getState(); if (state != null) { if (state == 0) { state = null; // 鎵�鏈� @@ -222,19 +197,14 @@ if (state != null && orderState != null && (orderState == 2 || orderState == 3)) { state = null; } - - // 璁㈠崟绫诲瀷 - Integer orderType = null; - if (StringUtil.isNullOrEmpty(type)) { - orderType = null; - } else if (!"0".equalsIgnoreCase(type)) { - orderType = Integer.parseInt(type); - } - - if (goodsType != null && goodsType == 0) - goodsType = null; + filter.setState(state); + filter.setOrderState(orderState); // 绛涢�夋椂闂� + Integer dateType = filter.getDateType(); + String startTime = filter.getStartTime(); + String endTime = filter.getEndTime(); + Integer slotTime = filter.getSlotTime(); if (slotTime != null) { try { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); @@ -268,33 +238,71 @@ e.printStackTrace(); } } + filter.setDateType(dateType); + filter.setStartTime(startTime); if (endTime != null && endTime.trim().length() > 0) { endTime += " 23:59:59"; } + filter.setEndTime(endTime); - List<Integer> listSource = new ArrayList<>(); - if (goodsType != null) { - listSource.add(goodsType); + } + + /** + * 璁㈠崟鍒楄〃 + * @param acceptData + * @param page + * @param filter + * @param out + */ + @RequestMapping(value = "getOrderList", method = RequestMethod.POST) + public void getOrderList(AcceptData acceptData, Integer page, SearchFilterOrder filter, PrintWriter out) { + Long uid = filter.getUid(); + if (uid == null) { + out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); + return; } + if (page == null || page < 1) + page = 1; + + handleSearchFilter(filter); + String startTime = filter.getStartTime(); + String endTime = filter.getEndTime(); + Integer orderType = filter.getOrderType(); + Integer dateType = filter.getDateType(); + Integer state = filter.getState(); + List<Integer> listSource = filter.getListSource(); + Integer orderState = filter.getOrderState(); + try { - boolean notBackSuVip = false; if (!VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { - notBackSuVip = true; + if (listSource.size() == 0) { + listSource.add(Constant.SOURCE_TYPE_TAOBAO); + listSource.add(Constant.SOURCE_TYPE_JD); + listSource.add(Constant.SOURCE_TYPE_PDD); + } + } + + // 鎼滅储鍐呭銆佽鍗曞彿 + String orderNo = filter.getOrderNo(); + if (!StringUtil.isNullOrEmpty(orderNo) + && VersionUtil.greaterThan_2_0_6(acceptData.getPlatform(), acceptData.getVersion())) { + searchOrder(acceptData, orderNo, page, uid, listSource, out); + return; } // 绛涢�夌粨鏋滈《閮ㄧ粺璁� String validMoney = "0.00"; String invalidMoney = "0.00"; if (page == 1) { - BigDecimal predictMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 1, - orderNo, state, startTime, endTime, listSource, notBackSuVip); + BigDecimal predictMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, filter.getDateType(), + orderType, 1, orderNo, state, startTime, endTime, listSource); if (predictMoney != null) validMoney = predictMoney.setScale(2, BigDecimal.ROUND_DOWN).toString(); - BigDecimal postSaleMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 2, - orderNo, state, startTime, endTime, listSource, notBackSuVip); + BigDecimal postSaleMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, filter.getDateType(), + orderType, 2, orderNo, state, startTime, endTime, listSource); if (postSaleMoney != null) invalidMoney = postSaleMoney.setScale(2, BigDecimal.ROUND_DOWN).toString(); @@ -311,10 +319,10 @@ List<CommonOrderVO> list = null; if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { list = commonOrderService.getOrderList(acceptData, page, uid, state, orderType, orderState, orderNo, - startTime, endTime, dateType, listSource, notBackSuVip); + startTime, endTime, dateType, listSource); count = commonOrderService.countOrderList(uid, state, orderType, orderState, orderNo, startTime, - endTime, dateType, listSource, notBackSuVip); + endTime, dateType, listSource); } else { list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType, orderState, orderNo, startTime, endTime, dateType, listSource); @@ -326,14 +334,14 @@ String orderFindUrl = null; if (state == null && page == 1) { if (redisManager.frequencyLimit("orderlist-" + acceptData.getDevice(), 8, 4) || count == 0L) { - orderFindUrl = configService.get(ConfigKeyEnum.orderFindNotifyUrl.getKey()); + orderFindUrl = configService.getValue(ConfigKeyEnum.orderFindNotifyUrl.getKey(),acceptData.getSystem()); } } JSONObject data = new JSONObject(); data.put("count", count); data.put("result_list", JsonUtil.getApiCommonGson().toJson(list)); - data.put("helpUrl", configService.get(ConfigKeyEnum.orderListHelp.getKey())); + data.put("helpUrl", configService.getValue(ConfigKeyEnum.orderListHelp.getKey(),acceptData.getSystem())); data.put("validMoney", "楼 " + validMoney); data.put("invalidMoney", "楼 " + invalidMoney); data.put("findOrderHelpUrl", orderFindUrl); @@ -348,20 +356,19 @@ /** * 鎼滅储璁㈠崟 + * * @param key * @param out */ - private void searchOrder(AcceptData acceptData, String key, Integer page, Long uid, PrintWriter out) { + private void searchOrder(AcceptData acceptData, String key, Integer page, Long uid, List<Integer> listSource, PrintWriter out) { try { long count = 0; List<CommonOrderVO> list = null; if (NumberUtil.isNumeric(key.replace("-", ""))) { if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { - commonOrderService.getOrderList(acceptData, page, uid, null, null, null, key, null, null, null, - null, false); + list = commonOrderService.getOrderList(acceptData, page, uid, null, null, null, key, null, null, null,listSource); } else - list = commonOrderService.getOrderByUid(acceptData, page, uid, null, null, null, key, null, null, - null, null); + list = commonOrderService.getOrderByUid(acceptData, page, uid, null, null, null, key, null, null, null, listSource); } if (list == null || list.size() == 0) { @@ -393,9 +400,7 @@ * 鐢ㄦ埛璁㈠崟缁熻 * * @param acceptData - * @param uid - * 鐢ㄦ埛id - * type 绫诲瀷锛�0鍏ㄩ儴銆�1娣樺疂 2浜笢銆佹嫾澶氬 + * @param uid 鐢ㄦ埛id type 绫诲瀷锛�0鍏ㄩ儴銆�1娣樺疂 2浜笢銆佹嫾澶氬 * @param out */ @RequestMapping(value = "getOrderCount", method = RequestMethod.POST) @@ -463,9 +468,10 @@ /** * 缁熻濂栭噾 + * * @param acceptData * @param uid - * @param dateType 1-浠婃棩 2-鏄ㄥぉ 3-鏈湀 4-涓婁釜鏈� + * @param dateType 1-浠婃棩 2-鏄ㄥぉ 3-鏈湀 4-涓婁釜鏈� * @param out */ @RequestMapping(value = "getBonusCount", method = RequestMethod.POST) @@ -528,6 +534,7 @@ /** * 杩斿埄璇存槑 + * * @param acceptData * @param uid * @param orderNo @@ -781,7 +788,7 @@ long currentTime = java.lang.System.currentTimeMillis(); if (endDay.getTime() > currentTime && !vip) { UserSystemCouponRecord couponRecord = userSystemCouponRecordService.getRecordByOrderNo(orderNo, - null); + sourceType, null); if (couponRecord == null) { orderRebateVO.setCoupon(true); orderRebateVO.setCouponType(1); @@ -801,9 +808,7 @@ * 鐢ㄦ埛璁㈠崟缁熻 * * @param acceptData - * @param uid - * 鐢ㄦ埛id - * type 绫诲瀷锛�0鍏ㄩ儴銆�1娣樺疂 2浜笢銆佹嫾澶氬 + * @param uid 鐢ㄦ埛id type 绫诲瀷锛�0鍏ㄩ儴銆�1娣樺疂 2浜笢銆佹嫾澶氬 * @param out */ @RequestMapping(value = "teamOrderSearch") -- Gitblit v1.8.0