|  | @@ -2500,23 +2500,23 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              processRecordEntity.setPaymentStartTime(new Date());
 | 
	
		
			
				|  |  |              // 判断是微信的支付码还是支付宝的支付码
 | 
	
		
			
				|  |  | -//            if (parCode.startsWith("28")) {
 | 
	
		
			
				|  |  | -//                // 支付宝支付
 | 
	
		
			
				|  |  | -//                try {
 | 
	
		
			
				|  |  | -//                    AliPay(user, parCode, order, processRecordEntity, orderWXPayRecordCurrent, store);
 | 
	
		
			
				|  |  | -//                } catch (Exception e) {
 | 
	
		
			
				|  |  | -//                    LOGGER.error("支付宝支付出现异常!订单号:【{}】", order.getOrder_sn(), e);
 | 
	
		
			
				|  |  | -//                    throw e;
 | 
	
		
			
				|  |  | -//                }
 | 
	
		
			
				|  |  | -//            } else {
 | 
	
		
			
				|  |  | -//                // 微信支付
 | 
	
		
			
				|  |  | -//                try {
 | 
	
		
			
				|  |  | -//                    wxPay(user, parCode, resultObj, order, processRecordEntity, orderWXPayRecordCurrent, store);
 | 
	
		
			
				|  |  | -//                } catch (Exception e) {
 | 
	
		
			
				|  |  | -//                    e.printStackTrace();
 | 
	
		
			
				|  |  | -//                    throw e;
 | 
	
		
			
				|  |  | -//                }
 | 
	
		
			
				|  |  | -//            }
 | 
	
		
			
				|  |  | +            if (parCode.startsWith("28")) {
 | 
	
		
			
				|  |  | +                // 支付宝支付
 | 
	
		
			
				|  |  | +                try {
 | 
	
		
			
				|  |  | +                    AliPay(user, parCode, order, processRecordEntity, orderWXPayRecordCurrent, store);
 | 
	
		
			
				|  |  | +                } catch (Exception e) {
 | 
	
		
			
				|  |  | +                    LOGGER.error("支付宝支付出现异常!订单号:【{}】", order.getOrder_sn(), e);
 | 
	
		
			
				|  |  | +                    throw e;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                // 微信支付
 | 
	
		
			
				|  |  | +                try {
 | 
	
		
			
				|  |  | +                    wxPay(user, parCode, resultObj, order, processRecordEntity, orderWXPayRecordCurrent, store);
 | 
	
		
			
				|  |  | +                } catch (Exception e) {
 | 
	
		
			
				|  |  | +                    e.printStackTrace();
 | 
	
		
			
				|  |  | +                    throw e;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              processRecordEntity.setPaymentStartTime(new Date());
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2749,9 +2749,9 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |              JedisUtil.del(Constants.WAREHOUSE_STOCK_MAP_KEY + "_" + storeId);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              // TODO 推单测试用
 | 
	
		
			
				|  |  | -            order.setPayApp("wxpay");
 | 
	
		
			
				|  |  | -            order.setRequest("1111111111111111111");
 | 
	
		
			
				|  |  | -            order.setResponse("2222222222222222222");
 | 
	
		
			
				|  |  | +//            order.setPayApp("wxpay");
 | 
	
		
			
				|  |  | +//            order.setRequest("1111111111111111111");
 | 
	
		
			
				|  |  | +//            order.setResponse("2222222222222222222");
 | 
	
		
			
				|  |  |              // 推单
 | 
	
		
			
				|  |  |              sendOrderInfoToVmcShop(order, orderGoodsVoList);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2872,7 +2872,7 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |          payInfoDTO.setPayMode("offline");
 | 
	
		
			
				|  |  |          payInfoDTO.setRequest(order.getRequest());
 | 
	
		
			
				|  |  |          payInfoDTO.setResponse(order.getResponse());
 | 
	
		
			
				|  |  | -        payInfoDTO.setOutTradeNo(order.getOrder_sn());
 | 
	
		
			
				|  |  | +        payInfoDTO.setOutTradeNo(order.getAliTradeNo());
 | 
	
		
			
				|  |  |          return payInfoDTO;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2962,7 +2962,7 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |          LOGGER.info("调用阿里支付接口的同步返回结果:" + responseJson);
 | 
	
		
			
				|  |  |          order.setResponse(responseJson);
 | 
	
		
			
				|  |  |          order.setPayApp("alipay");
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        order.setAliTradeNo(aliPayMicropayApiResult.getTradeNo());
 | 
	
		
			
				|  |  |          // 修改订单状态
 | 
	
		
			
				|  |  |          //当支付成功时,修改订单,并把其他支付记录撤销
 | 
	
		
			
				|  |  |          if (AliPayUtil.AliPayTradeState.SUCC.getCode().equals(aliPayMicropayApiResult.getCode())) {
 | 
	
	
		
			
				|  | @@ -2974,19 +2974,7 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |              processRecordEntity.setPaymentSuccTime(aliPayMicropayApiResult.getGmtPayment());
 | 
	
		
			
				|  |  |              processRecordEntity.setPayTransactionId(aliPayMicropayApiResult.getTradeNo());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            // 组装支付单信息
 | 
	
		
			
				|  |  | -            Map<String, Object> orderSendCusParams = new HashMap<>();
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("merchSn", order.getMerchSn());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("orderSn", order.getOrder_sn());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("merchName", order.getMerchName());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("thirdPartyMerchCode", store.getThirdPartyMerchCode());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("thirdPartyMerchName", store.getThirdPartyMerchName());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("tradeNo", order.getAliTradeNo());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("amount", order.getActual_price());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            // 将支付单信息发送到当前项目下的 cuspay
 | 
	
		
			
				|  |  | -            aliCusDeclareBiz.biz(orderSendCusParams);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +            sendAliPayInfo(order, store);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              // 系统繁忙
 | 
	
		
			
				|  |  |          } else if (AliPayUtil.AliPayTradeState.SERVER_FAIL.getCode().equals(aliPayMicropayApiResult.getCode())) {
 | 
	
	
		
			
				|  | @@ -3060,6 +3048,21 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    private void sendAliPayInfo(OrderVo order, StoreEntity store) {
 | 
	
		
			
				|  |  | +        // 组装支付单信息
 | 
	
		
			
				|  |  | +        Map<String, Object> orderSendCusParams = new HashMap<>();
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("merchSn", order.getMerchSn());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("orderSn", order.getOrder_sn());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("merchName", order.getMerchName());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("thirdPartyMerchCode", store.getThirdPartyMerchCode());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("thirdPartyMerchName", store.getThirdPartyMerchName());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("tradeNo", order.getAliTradeNo());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("amount", order.getActual_price());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 将支付单信息发送到当前项目下的 cuspay
 | 
	
		
			
				|  |  | +        aliCusDeclareBiz.biz(orderSendCusParams);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 微信支付
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -3084,16 +3087,19 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |          order.setRequest(payOriginInfoDTO.getRequest());
 | 
	
		
			
				|  |  |          order.setResponse(payOriginInfoDTO.getResponse());
 | 
	
		
			
				|  |  |          order.setPayApp("wxpay");
 | 
	
		
			
				|  |  | +        order.setFeeType(wechatMicropayApiResult.getFee_type());
 | 
	
		
			
				|  |  | +        order.setAliTradeNo(wechatMicropayApiResult.getTransaction_id());
 | 
	
		
			
				|  |  |          resultObj.put("shopName", store.getStoreName()); // 根据门店编号查询
 | 
	
		
			
				|  |  |          resultObj.put("userName", user.getUsername());
 | 
	
		
			
				|  |  |          // 修改订单状态
 | 
	
		
			
				|  |  |          //当支付成功时,修改订单,并把其他支付记录撤销
 | 
	
		
			
				|  |  | +        AtomicBoolean atomicBoolean = new AtomicBoolean(false);
 | 
	
		
			
				|  |  |          if (WechatUtil.WXTradeState.SUCCESS.getCode().equals(wechatMicropayApiResult.getTrade_state())) {
 | 
	
		
			
				|  |  |              //查询当前订单所有的支付记录
 | 
	
		
			
				|  |  |              List<OrderWXPayRecordEntity> orderWXPayRecordEntitys =
 | 
	
		
			
				|  |  |                      orderWXPayRecordService.getRecordsByOutTradeNo(order.getOrder_sn());
 | 
	
		
			
				|  |  |              LOGGER.info("wechatMicropayApiResult.getTransaction_id()" + wechatMicropayApiResult.getTransaction_id());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +            order.setPayTransactionId(wechatMicropayApiResult.getTransaction_id());
 | 
	
		
			
				|  |  |              Map orderRaram = Maps.newHashMap();
 | 
	
		
			
				|  |  |              orderRaram.put("payTransactionId", wechatMicropayApiResult.getTransaction_id());
 | 
	
		
			
				|  |  |              orderRaram.put("orderId", order.getId());
 | 
	
	
		
			
				|  | @@ -3106,20 +3112,7 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |                      new SimpleDateFormat("yyyyMMddHHmmss").parse(wechatMicropayApiResult.getTime_end()));
 | 
	
		
			
				|  |  |              processRecordEntity.setPayTransactionId(wechatMicropayApiResult.getTransaction_id());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            // 组装支付单信息
 | 
	
		
			
				|  |  | -            Map<String, Object> orderSendCusParams = new HashMap<>();
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("merchSn", order.getMerchSn());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("orderSn", order.getOrder_sn());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("merchName", order.getMerchName());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("thirdPartyMerchCode", store.getThirdPartyMerchCode());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("thirdPartyMerchName", store.getThirdPartyMerchName());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("outTradeNo", order.getMerchOrderSn());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("transactionId", order.getPayTransactionId());
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("subOrderId", "");   // ccnet原逻辑没有对该字段赋值
 | 
	
		
			
				|  |  | -            orderSendCusParams.put("subOrderNo", order.getOrder_sn());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            // 将支付单信息发送到当前项目下的 cuspay
 | 
	
		
			
				|  |  | -            wxCusDeclareBiz.biz(orderSendCusParams);
 | 
	
		
			
				|  |  | +            atomicBoolean.set(true);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              //用户支付中
 | 
	
		
			
				|  |  |          } else if (WechatUtil.WXTradeState.USERPAYING.getCode().equals(wechatMicropayApiResult.getTrade_state())) {
 | 
	
	
		
			
				|  | @@ -3129,6 +3122,7 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |              while (true) {
 | 
	
		
			
				|  |  |                  boolean flag = orderQuery(order, processRecordEntity);
 | 
	
		
			
				|  |  |                  if (flag) {
 | 
	
		
			
				|  |  | +                    atomicBoolean.set(true);
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  try {
 | 
	
	
		
			
				|  | @@ -3166,6 +3160,37 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              throw new RuntimeException("未支付或支付失败,请联系管理员");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (atomicBoolean.get()) {
 | 
	
		
			
				|  |  | +            // 推送支付单
 | 
	
		
			
				|  |  | +            sendWxPayInfo(order, store);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void sendWxPayInfo(OrderVo order, StoreEntity store) {
 | 
	
		
			
				|  |  | +        // 组装支付单信息
 | 
	
		
			
				|  |  | +        Map<String, Object> orderSendCusParams = new HashMap<>();
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("merchSn", order.getMerchSn());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("orderSn", order.getOrder_sn());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("merchName", order.getMerchName());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("thirdPartyMerchCode", store.getThirdPartyMerchCode());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("thirdPartyMerchName", store.getThirdPartyMerchName());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("outTradeNo", order.getMerchOrderSn());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("transactionId", order.getPayTransactionId());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("subOrderId", "");   // ccnet原逻辑没有对该字段赋值
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("subOrderNo", order.getOrder_sn());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("feeType", order.getFeeType());
 | 
	
		
			
				|  |  | +        int orderFee = order.getActual_price().multiply(new BigDecimal(100)).intValue();
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("orderFee", orderFee);
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("productFee", orderFee);
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("transportFee", 0);
 | 
	
		
			
				|  |  | +        UserEntity userEntity = userService.queryByMobile(order.getMobile());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("certId", userEntity.getIdNo());
 | 
	
		
			
				|  |  | +        orderSendCusParams.put("name", order.getPay_name());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 将支付单信息发送到当前项目下的 cuspay
 | 
	
		
			
				|  |  | +        wxCusDeclareBiz.biz(orderSendCusParams);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -5189,6 +5214,14 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |              orderSendCusParams.put("transactionId", orderEntity.getPayTransactionId());
 | 
	
		
			
				|  |  |              orderSendCusParams.put("subOrderId", "");   // ccnet原逻辑没有对该字段赋值
 | 
	
		
			
				|  |  |              orderSendCusParams.put("subOrderNo", orderEntity.getOrderSn());
 | 
	
		
			
				|  |  | +            orderSendCusParams.put("feeType", "CNY");
 | 
	
		
			
				|  |  | +            int orderFee = orderEntity.getActualPrice().multiply(new BigDecimal(100)).intValue();
 | 
	
		
			
				|  |  | +            orderSendCusParams.put("orderFee", orderFee);
 | 
	
		
			
				|  |  | +            orderSendCusParams.put("productFee", orderFee);
 | 
	
		
			
				|  |  | +            orderSendCusParams.put("transportFee", 0);
 | 
	
		
			
				|  |  | +            UserEntity userEntity = userService.queryByMobile(orderEntity.getMobile());
 | 
	
		
			
				|  |  | +            orderSendCusParams.put("certId", userEntity.getIdNo());
 | 
	
		
			
				|  |  | +            orderSendCusParams.put("name", orderEntity.getPayName());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              // 将支付单信息发送到当前项目下的 cuspay
 | 
	
		
			
				|  |  |              wxCusDeclareBiz.biz(orderSendCusParams);
 |