From 7ac0b5be02902a96bd1feb658e41a9b69fa50738 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 29 六月 2024 01:37:31 +0800 Subject: [PATCH] 功能完善 --- src/main/java/com/taoke/autopay/controller/client/OrderController.java | 36 ++++++++++++++++++++++++++++++++---- 1 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/taoke/autopay/controller/client/OrderController.java b/src/main/java/com/taoke/autopay/controller/client/OrderController.java index 77140b3..be07e1e 100644 --- a/src/main/java/com/taoke/autopay/controller/client/OrderController.java +++ b/src/main/java/com/taoke/autopay/controller/client/OrderController.java @@ -8,13 +8,15 @@ import com.google.gson.stream.JsonWriter; import com.taoke.autopay.dao.KeyOrderMapper; import com.taoke.autopay.dto.DYOrderDto; -import com.taoke.autopay.entity.ClientInfo; -import com.taoke.autopay.entity.KeyOrder; +import com.taoke.autopay.entity.*; import com.taoke.autopay.exception.KeyOrderException; +import com.taoke.autopay.exception.WxOrderCountException; import com.taoke.autopay.factory.OrderFactory; import com.taoke.autopay.service.ClientInfoService; import com.taoke.autopay.service.KeyOrderService; +import com.taoke.autopay.service.WxUserOrderCountService; +import com.taoke.autopay.service.WxUserSettingService; import com.taoke.autopay.utils.JsonUtil; import com.taoke.autopay.utils.StringUtil; import com.taoke.autopay.utils.TimeUtil; @@ -68,6 +70,13 @@ @Resource private ClientInfoService clientInfoService; + + @Resource + private WxUserOrderCountService wxUserOrderCountService; + + @Resource + private WxUserSettingService wxUserSettingService; + @ResponseBody @RequestMapping("listOrder") @@ -154,7 +163,7 @@ * @param: id 璁㈠崟ID * @param: orderNo 璁㈠崟鍙� * @param: orderStatus 璁㈠崟鐘舵�侊細璁㈠崟宸插彇娑�/宸叉敮浠� - * @return java.lang.String + * @return java.lang.String 杩斿洖鏄惁鍙互鍘绘敮浠� **/ @ResponseBody @RequestMapping("setOrderNo") @@ -181,6 +190,9 @@ } try { + if(!StringUtil.isNullOrEmpty(orderStatus)){ + throw new KeyOrderException(orderStatus); + } DYOrderDto dto = DYOrderApi.getOrderDetail(orderNo); // dto.setOrder_status(1); if (dto.getOrder_status() != DYOrderDto.ORDER_STATUS_NOT_PAY) { @@ -206,6 +218,17 @@ throw new Exception("璁㈠崟宸叉敮浠�"); } } + + if(order.getUid()!=null) { + WxUserOrderCount countInfo = wxUserOrderCountService.get(order.getUid(), OrderCountTypeEnum.DY_ORDER_PAY, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd")); + if (countInfo != null) { + WxUserSettings settings = wxUserSettingService.selectByUid(order.getUid()); + if (settings.getDyOrderCountPerDay()<=countInfo.getOrderCount()){ + throw new Exception("浠婃棩宸茶揪鏀粯娆℃暟涓婇檺锛�"+settings.getDyOrderCountPerDay()); + } + } + } + // 璁剧疆杩涘叆 KeyOrder orderUpdate = new KeyOrder(); orderUpdate.setId(id); @@ -259,7 +282,12 @@ orderUpdate.setId(id); orderUpdate.setState(KeyOrder.STATE_PAY); orderUpdate.setStateDesc("鏀粯鎴愬姛"); - keyOrderService.update(orderUpdate); + try { + keyOrderService.paySuccess(id,"鏀粯鎴愬姛",TimeUtil.getGernalTime(System.currentTimeMillis(),"yyyyMMdd")); + } catch (WxOrderCountException e) { + e.printStackTrace(); + return JsonUtil.loadFalseResult(e.getMessage()); + } } } return JsonUtil.loadTrueResult(""); -- Gitblit v1.8.0