@Override public void notifyMsg(OrderTrade orderTrade) { TreeMap<String, Object> map = new TreeMap<>(); map.put("tradeNo", orderTrade.getTradeNo()); map.put("orderNo", orderTrade.getOrderNo()); map.put("orderStatus", orderTrade.getOrderStatus()); map.put("amont", orderTrade.getFacePrice()); if (ItemCategoryEnum.EXCHANGE.getCode().equals(orderTrade.getItemCategory())) { // 兑换通知 map.put("cardNo", orderTrade.getCardNo()); } else if (ItemCategoryEnum.RECHARGE.getCode().equals(orderTrade.getItemCategory())) { // 充值通知 map.put("mobile", orderTrade.getMobile()); } else { logger.warn("未知商品类型={}", orderTrade.getItemCategory()); return; } /*String result = HttpRestUtil.postForObject(orderTrade.getNotifyUrl(), map, String.class); logger.warn("通知下游:url={},参数={},返回={}", orderTrade.getNotifyUrl(), map, result); if (!"success".equalsIgnoreCase(result)) { // 失败,继续重复通知 try { Thread.sleep(10000L); } catch (InterruptedException e) { logger.error("线程出错", e.getMessage()); } result = HttpRestUtil.postForObject(orderTrade.getNotifyUrl(), map, String.class); }*/ }
@Override public void notifyMsg(OrderTrade orderTrade) { TreeMap<String, Object> map = new TreeMap<>(); map.put("tradeNo", orderTrade.getTradeNo()); map.put("orderNo", orderTrade.getOrderNo()); map.put("orderStatus", orderTrade.getOrderStatus()); map.put("amont", orderTrade.getFacePrice()); if (ItemCategoryEnum.EXCHANGE.getCode().equals(orderTrade.getItemCategory())) { // 兑换通知 map.put("cardNo", orderTrade.getCardNo()); } else if (ItemCategoryEnum.RECHARGE.getCode().equals(orderTrade.getItemCategory())) { // 充值通知 map.put("mobile", orderTrade.getMobile()); } else { logger.warn("未知商品类型={}", orderTrade.getItemCategory()); return; } /*String result = HttpRestUtil.postForObject(orderTrade.getNotifyUrl(), map, String.class); logger.warn("通知下游:url={},参数={},返回={}", orderTrade.getNotifyUrl(), map, result); if (!"success".equalsIgnoreCase(result)) { // 失败,继续重复通知 try { Thread.sleep(10000L); } catch (InterruptedException e) { logger.error("线程出错", e.getMessage()); } result = HttpRestUtil.postForObject(orderTrade.getNotifyUrl(), map, String.class); }*/ }
/** * 补兑换接口 */ public Result<OrderTrade> repairExchange(Long tradeNo) { OrderTrade orderTrade = exchangeManager.getOrderTradeByTradeNo(tradeNo); if (!OrderStatusEnum.FAIL.getCode().equals(orderTrade.getOrderStatus())) { // 不是失败的交易订单,不允许补充 return Result.error("不是失败的交易订单,不允许补充"); } orderTrade.setRepeatType(RepeatTypeEnum.YES.getCode()); orderTrade.setSupplyIndex(0); Result<OrderSupply> resultorderSupply = exchangeService.supplyExchange(orderTrade); if (!resultorderSupply.getCode().equals(ResultEnum.SUCCESS.getCode())) { // 失败 orderTrade.setSupplyDesc(resultorderSupply.getMsg()); orderTrade.setOrderStatus(OrderStatusEnum.FAIL.getCode()); exchangeManager.updateOrderTrade(orderTrade); return Result.error(resultorderSupply.getCode(), resultorderSupply.getMsg()); } return Result.success(orderTrade); }
OrderTrade orderTrade = rechargeManager.getOrderTradeByTradeNo(tradeNo); if (!OrderStatusEnum.FAIL.getCode().equals(orderTrade.getOrderStatus())) {