@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); }*/ }
final Thread currentThread = Thread.currentThread(); final String threadName = currentThread.getName(); currentThread.setName(String.format(currentThread.getName() + "-供货线程(订单号:%d-供货单:%d-供货商品ID:%d-供货商ID:%s)", orderTrade.getTradeNo(), orderSupply.getSupplySerialNo(), orderSupply.getItemSupplyId(), orderSupply.getSupplyName())); final long time2 = System.currentTimeMillis();
final Thread currentThread = Thread.currentThread(); final String threadName = currentThread.getName(); currentThread.setName(String.format(currentThread.getName() + "-供货线程:(订单号:%d-供货单:%d-供货商品ID:%d-供货商ID:%s)", orderTrade.getTradeNo(), orderSupply.getSupplySerialNo(), orderSupply.getItemSupplyId(), orderSupply.getSupplyName())); final long time2 = System.currentTimeMillis();
private Result<RechargeResponse> completeRechargeResponse(OrderTrade orderTrade) { RechargeResponse resp = new RechargeResponse(); resp.setMoblie(orderTrade.getMobile()); resp.setOrderNo(orderTrade.getOrderNo()); resp.setTradeNo(orderTrade.getTradeNo().toString()); return Result.success(resp); }
private Result<ExchangeResponse> completeExchangeResponse(OrderTrade orderTrade) { ExchangeResponse resp = new ExchangeResponse(); resp.setAmount(orderTrade.getMobile()); resp.setCardNo(orderTrade.getCardNo()); resp.setOrderNo(orderTrade.getOrderNo()); resp.setTradeNo(orderTrade.getTradeNo().toString()); return Result.success(resp); }
private Result<ExchangeOrderResponse> completeExchangeOrderResponse(OrderTrade orderTrade) { ExchangeOrderResponse resp = new ExchangeOrderResponse(); resp.setTradeNo(orderTrade.getTradeNo()); resp.setOrderNo(orderTrade.getOrderNo()); resp.setProductNo(orderTrade.getItemNo()); resp.setProductType(orderTrade.getItemType()); resp.setMoblie(orderTrade.getMobile()); resp.setFacePrice(orderTrade.getFacePrice()); resp.setSalesPrice(orderTrade.getSalesPrice()); return Result.success(resp); }
private Result<ExchangeOrderResponse> completeExchangeOrderResponse(OrderTrade orderTrade) { ExchangeOrderResponse resp = new ExchangeOrderResponse(); resp.setTradeNo(orderTrade.getTradeNo()); resp.setOrderNo(orderTrade.getOrderNo()); resp.setProductNo(orderTrade.getItemNo()); resp.setProductType(orderTrade.getItemType()); resp.setMoblie(orderTrade.getMobile()); resp.setFacePrice(orderTrade.getFacePrice()); resp.setSalesPrice(orderTrade.getSalesPrice()); return Result.success(resp); }
private OrderTradePay createOrderTradePay(OrderTrade orderTrade) { OrderTradePay orderTradePay = new OrderTradePay(); orderTradePay.setPayStatus(PayStatusEnum.CREATE.getCode()); orderTradePay.setPaySerialNo(IdWorker.getId()); orderTradePay.setOrderTradeNo(orderTrade.getTradeNo()); orderTradePay.setUserInfoId(orderTrade.getUserInfoId()); orderTradePay.setAcctInfoId(orderTrade.getAcctInfoId()); orderTradePay.setItemId(orderTrade.getItemId()); orderTradePay.setItemNo(orderTrade.getItemNo()); // 兑换类型为:加款 orderTradePay.setTradeType(TradeTypeEnum.ADD.getCode()); orderTradePay.setSalesPrice(orderTrade.getSalesPrice()); orderTradePay.setPayType(PayTypeEnum.BALANCE.getCode()); Long id = orderTradePayDao.save(orderTradePay); orderTradePay.setId(id); orderTrade.setPaySerialNo(orderTradePay.getPaySerialNo()); return orderTradePay; }
/** * 支付订单 */ private OrderTradePay createOrderTradePay(OrderTrade orderTrade) { OrderTradePay orderTradePay = new OrderTradePay(); orderTradePay.setPayStatus(PayStatusEnum.CREATE.getCode()); orderTradePay.setPaySerialNo(IdWorker.getId()); orderTradePay.setOrderTradeNo(orderTrade.getTradeNo()); orderTradePay.setUserInfoId(orderTrade.getUserInfoId()); orderTradePay.setAcctInfoId(orderTrade.getAcctInfoId()); orderTradePay.setItemId(orderTrade.getItemId()); orderTradePay.setItemNo(orderTrade.getItemNo()); orderTradePay.setTradeType(TradeTypeEnum.SUBTRACT.getCode()); orderTradePay.setSalesPrice(orderTrade.getSalesPrice()); orderTradePay.setPayType(PayTypeEnum.BALANCE.getCode()); Long id = orderTradePayDao.save(orderTradePay); orderTradePay.setId(id); orderTrade.setPaySerialNo(orderTradePay.getPaySerialNo()); return orderTradePay; }
/** * 退款订单 */ private OrderTradePay createOrderTradePayForRefund(OrderTrade orderTrade) { OrderTradePay orderTradePay = new OrderTradePay(); orderTradePay.setPayStatus(PayStatusEnum.CREATE.getCode()); orderTradePay.setPaySerialNo(IdWorker.getId()); orderTradePay.setOrderTradeNo(orderTrade.getTradeNo()); orderTradePay.setUserInfoId(orderTrade.getUserInfoId()); orderTradePay.setAcctInfoId(orderTrade.getAcctInfoId()); orderTradePay.setItemId(orderTrade.getItemId()); orderTradePay.setItemNo(orderTrade.getItemNo()); orderTradePay.setTradeType(TradeTypeEnum.ADD.getCode()); orderTradePay.setSalesPrice(orderTrade.getSalesPrice()); orderTradePay.setPayType(PayTypeEnum.BALANCE.getCode()); Long id = orderTradePayDao.save(orderTradePay); orderTradePay.setId(id); orderTrade.setPaySerialNo(orderTradePay.getPaySerialNo()); return orderTradePay; }
@Override public OrderSupply createOrderSupply(OrderTrade orderTrade, SupplyInfo supplyInfo) { OrderSupply orderSupply = new OrderSupply(); orderSupply.setOrderStatus(OrderStatusEnum.CREATE.getCode()); orderSupply.setOrderTradeNo(orderTrade.getTradeNo()); orderSupply.setItemSupplyId(orderTrade.getItemSupplyId()); orderSupply.setUserInfoId(orderTrade.getUserInfoId()); orderSupply.setItemId(orderTrade.getItemId()); orderSupply.setItemCategory(orderTrade.getItemCategory()); orderSupply.setItemType(orderTrade.getItemType()); orderSupply.setItemNo(orderTrade.getItemNo()); orderSupply.setItemName(orderTrade.getItemName()); orderSupply.setMobile(orderTrade.getMobile()); orderSupply.setSupplyInfoId(supplyInfo.getId()); orderSupply.setSupplyCode(supplyInfo.getSupplyCode()); orderSupply.setSupplyName(supplyInfo.getSupplyName()); orderSupply.setSupplySerialNo(IdWorker.getId()); orderSupply.setSupplyFacePrice(orderTrade.getFacePrice()); orderSupply.setSupplyCostPrice(orderTrade.getCostPrice()); orderSupply.setSupplyActualCost(orderTrade.getActualCost()); Long id = orderSupplyDao.save(orderSupply); orderSupply.setId(id); orderTrade.setSupplySerialNo(orderSupply.getSupplySerialNo()); return orderSupply; }
@Override public OrderSupply createOrderSupply(OrderTrade orderTrade, SupplyInfo supplyInfo) { OrderSupply orderSupply = new OrderSupply(); orderSupply.setOrderStatus(OrderStatusEnum.CREATE.getCode()); orderSupply.setOrderTradeNo(orderTrade.getTradeNo()); orderSupply.setItemSupplyId(orderTrade.getItemSupplyId()); orderSupply.setUserInfoId(orderTrade.getUserInfoId()); orderSupply.setItemId(orderTrade.getItemId()); orderSupply.setItemCategory(orderTrade.getItemCategory()); orderSupply.setItemType(orderTrade.getItemType()); orderSupply.setItemNo(orderTrade.getItemNo()); orderSupply.setItemName(orderTrade.getItemName()); orderSupply.setMobile(orderTrade.getMobile()); orderSupply.setSupplyInfoId(supplyInfo.getId()); orderSupply.setSupplyCode(supplyInfo.getSupplyCode()); orderSupply.setSupplyName(supplyInfo.getSupplyName()); orderSupply.setSupplySerialNo(IdWorker.getId()); orderSupply.setSupplyFacePrice(orderTrade.getFacePrice()); orderSupply.setSupplyCostPrice(orderTrade.getCostPrice()); orderSupply.setSupplyActualCost(orderTrade.getActualCost()); Long id = orderSupplyDao.save(orderSupply); orderSupply.setId(id); orderTrade.setSupplySerialNo(orderSupply.getSupplySerialNo()); return orderSupply; }