续租回调通知租电平台
This commit is contained in:
		| @ -11,6 +11,7 @@ import com.sczx.pay.mapper.OrderPayMapper; | ||||
| import com.sczx.pay.mapper.PaymentRecordMapper; | ||||
| import com.sczx.pay.mapper.RefundRecordMapper; | ||||
| import com.sczx.pay.sdk.WXPay; | ||||
| import com.sczx.pay.thirdpart.integration.SyncInteg; | ||||
| import com.sczx.pay.utils.WXPayUtil; | ||||
| import com.sczx.pay.utils.IPUtils; | ||||
| import org.slf4j.Logger; | ||||
| @ -51,6 +52,9 @@ public class WechatPayService { | ||||
|     @Autowired | ||||
|     private OrderPayMapper orderPayMapper; | ||||
|  | ||||
|     @Autowired | ||||
|     private SyncInteg syncInteg; | ||||
|  | ||||
|     @Value("${wechat.pay.app-id}") | ||||
|     private String appId; | ||||
|  | ||||
| @ -271,7 +275,7 @@ public class WechatPayService { | ||||
|             refundNotifyUrl | ||||
|         ); | ||||
|  | ||||
|         String path = certPath+companyConfig.getMchId()+".p12"; | ||||
|         String path = certPath+"wechatpay-"+companyConfig.getMchId()+"/"+companyConfig.getMchId()+".p12"; | ||||
|         String certAbsolutePath = getCertAbsolutePath(path); | ||||
|         wxPayConfig.setCertPath(certAbsolutePath); | ||||
|  | ||||
| @ -423,6 +427,9 @@ public class WechatPayService { | ||||
|                 }else if (OrderStatus.equals("RERENT_WAIT_PAY")){ | ||||
|                     OrderSub orderSub = orderPayMapper.getSubOrderByTradeNo(outTradeNo); | ||||
|                     orderPayMapper.updateOrderStatusAndEndRentTime(orderMain.getOrderNo(),orderSub.getReturnTime(),0,orderMain.getOrderAmount().add(orderSub.getAmount()),"RENT_ING"); | ||||
|                     //发送租电订单同步 | ||||
|                     Long batterySubOrderId = orderPayMapper.getSubOrderIdByTradeNo(outTradeNo); | ||||
|                     syncInteg.sendSubOrderId(batterySubOrderId); | ||||
|                 } | ||||
|                 orderPayMapper.updateSubOrderPaymentStatus(outTradeNo,"WX_PAY",PayStatus.SUCCESS.getCode(),transactionId); | ||||
|  | ||||
|  | ||||
| @ -14,6 +14,7 @@ import com.sczx.pay.mapper.OrderPayMapper; | ||||
| import com.sczx.pay.mapper.PaymentRecordMapper; | ||||
| import com.sczx.pay.mapper.RefundRecordMapper; | ||||
| import com.sczx.pay.service.AlipayService; | ||||
| import com.sczx.pay.thirdpart.integration.SyncInteg; | ||||
| import com.sczx.pay.utils.AlipaySdkUtil; | ||||
| import com.sczx.pay.utils.ThreadPoolUtils; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| @ -58,6 +59,9 @@ public class AlipayServiceImpl implements AlipayService { | ||||
|     @Autowired | ||||
|     private OrderPayMapper orderPayMapper; | ||||
|  | ||||
|     @Autowired | ||||
|     private SyncInteg syncInteg; | ||||
|  | ||||
|     @Override | ||||
|     public AlipayCreateResponse unifiedOrder(AlipayCreateRequest alipayCreateRequest) { | ||||
|         AlipayCreateResponse response = new AlipayCreateResponse(); | ||||
| @ -540,6 +544,9 @@ public class AlipayServiceImpl implements AlipayService { | ||||
|                 }else if (OrderStatus.equals("RERENT_WAIT_PAY")){ | ||||
|                     OrderSub orderSub = orderPayMapper.getSubOrderByTradeNo(outTradeNo); | ||||
|                     orderPayMapper.updateOrderStatusAndEndRentTime(orderMain.getOrderNo(),orderSub.getReturnTime(),0,orderMain.getOrderAmount().add(orderSub.getAmount()),"RENT_ING"); | ||||
|                     //发送租电订单同步 | ||||
|                     Long batterySubOrderId = orderPayMapper.getSubOrderIdByTradeNo(outTradeNo); | ||||
|                     syncInteg.sendSubOrderId(batterySubOrderId); | ||||
|                 } | ||||
|                 orderPayMapper.updateSubOrderPaymentStatus(outTradeNo,"ZFB_PAY", PayStatus.SUCCESS.getCode(),tradeNo); | ||||
|                 return true; | ||||
|  | ||||
							
								
								
									
										16
									
								
								src/main/java/com/sczx/pay/thirdpart/facade/SyncFacade.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/main/java/com/sczx/pay/thirdpart/facade/SyncFacade.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | ||||
| package com.sczx.pay.thirdpart.facade; | ||||
|  | ||||
|  | ||||
| import org.springframework.cloud.openfeign.FeignClient; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
|  | ||||
| import java.util.Map; | ||||
|  | ||||
| @FeignClient(name = "sczx-sync", url = "${sczx-sync.ribbon.listOfServers:}") | ||||
| public interface SyncFacade { | ||||
|  | ||||
|     @GetMapping("/send/subOrder/{subOrderId}") | ||||
|     Map<String, String> sendSubOrderId(@PathVariable Long subOrderId); | ||||
|  | ||||
| } | ||||
| @ -0,0 +1,34 @@ | ||||
| package com.sczx.pay.thirdpart.integration; | ||||
|  | ||||
|  | ||||
| import com.sczx.pay.exception.InnerException; | ||||
| import com.sczx.pay.thirdpart.facade.SyncFacade; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Component; | ||||
|  | ||||
| import java.util.Map; | ||||
|  | ||||
| @Slf4j | ||||
| @Component | ||||
| public class SyncInteg { | ||||
|  | ||||
|     @Autowired | ||||
|     private SyncFacade syncFacade; | ||||
|  | ||||
|     public Map<String, String> sendSubOrderId(Long subOrderId){ | ||||
|         try{ | ||||
|             Map<String, String> result = syncFacade.sendSubOrderId(subOrderId); | ||||
|             if(result.get("code") == "200"){ | ||||
|                 return result; | ||||
|             } | ||||
|         } catch (Exception e){ | ||||
|             log.error("发送租电订单同步失败",e); | ||||
|             throw new InnerException("发送租电订单同步失败"); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user