| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private ClientInfoService clientInfoService; |
| | | |
| | | @Resource |
| | | private WxUserOrderCountService wxUserOrderCountService; |
| | | |
| | | @Resource |
| | | private WxUserSettingService wxUserSettingService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("listOrder") |
| | |
| | | * @param: id 订单ID |
| | | * @param: orderNo 订单号 |
| | | * @param: orderStatus 订单状态:订单已取消/已支付 |
| | | * @return java.lang.String |
| | | * @return java.lang.String 返回是否可以去支付 |
| | | **/ |
| | | @ResponseBody |
| | | @RequestMapping("setOrderNo") |
| | |
| | | } |
| | | |
| | | 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) { |
| | |
| | | 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); |
| | |
| | | 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(""); |