Commit 5bf9a1012d96e856c41f66f6e62964c29d7804a0

Authored by fengliang
1 parent c136701e

update:推送微信发货留存手动触发接口

etrade-order/src/main/java/com/diligrp/etrade/order/api/OrderController.java
@@ -774,4 +774,21 @@ public class OrderController { @@ -774,4 +774,21 @@ public class OrderController {
774 } 774 }
775 } 775 }
776 776
  777 + /**
  778 + * 查询核销状态
  779 + * @param orderDto
  780 + * @return
  781 + */
  782 + @RequestMapping(value = "/sendToWeChatDelivery",method = {RequestMethod.POST},produces="application/json;charset=UTF-8")
  783 + public Message sendToWeChatDelivery(@RequestBody OrderGetDto orderDto){
  784 + try{
  785 + return Message.success(orderService.SendToWeChatPay(orderDto));
  786 + }catch (PlatformServiceException pe) {
  787 + LOGGER.warn("服务异常{}:{}",pe.getCode(), pe.getMessage());
  788 + return Message.failure("服务暂时不在线,请稍后");
  789 + }
  790 + }
  791 +
  792 +
  793 +
777 } 794 }
etrade-order/src/main/java/com/diligrp/etrade/order/service/OrderService.java
@@ -225,6 +225,13 @@ public interface OrderService { @@ -225,6 +225,13 @@ public interface OrderService {
225 * @param weChatPayTradeBackDto 225 * @param weChatPayTradeBackDto
226 */ 226 */
227 List<Order> wxChatPayCallBack(WeChatPayTradeCallBackDto weChatPayTradeBackDto); 227 List<Order> wxChatPayCallBack(WeChatPayTradeCallBackDto weChatPayTradeBackDto);
  228 +
  229 + /**
  230 + * 测试推送发货接口
  231 + * @param orderDto
  232 + */
  233 + Integer SendToWeChatPay(OrderGetDto orderDto);
  234 +
228 /** 235 /**
229 * 微信支付失败回调 236 * 微信支付失败回调
230 * @param weChatPayTradeBackDto 237 * @param weChatPayTradeBackDto
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderDeliveryServiceImpl.java
@@ -148,11 +148,7 @@ public class OrderDeliveryServiceImpl implements OrderDeliveryService { @@ -148,11 +148,7 @@ public class OrderDeliveryServiceImpl implements OrderDeliveryService {
148 WeChatPayFunctionDto weChatPayFunctionDto = new WeChatPayFunctionDto(); 148 WeChatPayFunctionDto weChatPayFunctionDto = new WeChatPayFunctionDto();
149 weChatPayFunctionDto.setMarketId(marketId); 149 weChatPayFunctionDto.setMarketId(marketId);
150 weChatPayFunctionDto.setPaymentId(paymentId); 150 weChatPayFunctionDto.setPaymentId(paymentId);
151 - if(OrderAchieveType.BUYER_SELF.getCodeInteger().equals(deliveryType)){  
152 - weChatPayFunctionDto.setLogisticsType(WeChatPayDeliverType.SELF_GET.getCode());  
153 - }else{  
154 - weChatPayFunctionDto.setLogisticsType(WeChatPayDeliverType.MARKET_SEND.getCode());  
155 - } 151 + weChatPayFunctionDto.setLogisticsType(deliveryType);
156 return weChatPayRpcResolver.deliver(weChatPayFunctionDto); 152 return weChatPayRpcResolver.deliver(weChatPayFunctionDto);
157 } 153 }
158 154
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderServiceImpl.java
@@ -938,6 +938,23 @@ public class OrderServiceImpl implements OrderService { @@ -938,6 +938,23 @@ public class OrderServiceImpl implements OrderService {
938 return orderList; 938 return orderList;
939 } 939 }
940 940
  941 + @Override
  942 + public Integer SendToWeChatPay(OrderGetDto orderDto){
  943 + Order order = getOneOrder(orderDto);
  944 + if(order.getDeliverySendState()==null||
  945 + !OrderConstant.SEND_TO_DELIVERY_SUCCESS.equals(order.getDeliverySendState())){
  946 + OrderPayment orderPayment = orderPaymentService.getOrderPaymentById(order.getId(), order.getMarketId(), OrderPaymentState.FINISH_PAY.getCodeInteger());
  947 + if(OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){
  948 + Integer sendState = sendToWeChatPayDeliver(order.getMarketId(), orderPayment.getTradeId(), WeChatPayDeliverType.MARKET_SEND.getCode());
  949 + orderMapper.updateDeliverySendStateByPaymentId(sendState,orderPayment.getTradeId());
  950 + return sendState;
  951 + }
  952 + }else{
  953 + return OrderConstant.SEND_TO_DELIVERY_SUCCESS;
  954 + }
  955 + return OrderConstant.SEND_TO_DELIVERY_FAIL;
  956 + }
  957 +
941 private Integer sendToWeChatPayDeliver(Long marketId, String paymentId, Integer deliveryType) { 958 private Integer sendToWeChatPayDeliver(Long marketId, String paymentId, Integer deliveryType) {
942 Message<WeChatPayInfoDto> weChatPayInfoDtoMessage = sendToPayRpcDeliver(marketId, paymentId, deliveryType); 959 Message<WeChatPayInfoDto> weChatPayInfoDtoMessage = sendToPayRpcDeliver(marketId, paymentId, deliveryType);
943 if(!weChatPayInfoDtoMessage.getCode().equals(200)){ 960 if(!weChatPayInfoDtoMessage.getCode().equals(200)){
@@ -951,11 +968,7 @@ public class OrderServiceImpl implements OrderService { @@ -951,11 +968,7 @@ public class OrderServiceImpl implements OrderService {
951 WeChatPayFunctionDto weChatPayFunctionDto = new WeChatPayFunctionDto(); 968 WeChatPayFunctionDto weChatPayFunctionDto = new WeChatPayFunctionDto();
952 weChatPayFunctionDto.setMarketId(marketId); 969 weChatPayFunctionDto.setMarketId(marketId);
953 weChatPayFunctionDto.setPaymentId(paymentId); 970 weChatPayFunctionDto.setPaymentId(paymentId);
954 - if(OrderAchieveType.BUYER_SELF.getCodeInteger().equals(deliveryType)){  
955 - weChatPayFunctionDto.setLogisticsType(WeChatPayDeliverType.SELF_GET.getCode());  
956 - }else{  
957 - weChatPayFunctionDto.setLogisticsType(WeChatPayDeliverType.MARKET_SEND.getCode());  
958 - } 971 + weChatPayFunctionDto.setLogisticsType(deliveryType);
959 return weChatPayRpcResolver.deliver(weChatPayFunctionDto); 972 return weChatPayRpcResolver.deliver(weChatPayFunctionDto);
960 } 973 }
961 974