Showing
3 changed files
with
7 additions
and
7 deletions
| ... | @@ -15,4 +15,5 @@ public class BusinessConfig { | ... | @@ -15,4 +15,5 @@ public class BusinessConfig { |
| 15 | private String hisCustomerQueryUrl; | 15 | private String hisCustomerQueryUrl; |
| 16 | private String clientCustomerQueryUrl; | 16 | private String clientCustomerQueryUrl; |
| 17 | private String payUrl; | 17 | private String payUrl; |
| 18 | + private String payClientId; | ||
| 18 | } | 19 | } | ... | ... |
| ... | @@ -23,7 +23,6 @@ import com.infoloop.tianting.utils.EncryptionUtil; | ... | @@ -23,7 +23,6 @@ import com.infoloop.tianting.utils.EncryptionUtil; |
| 23 | import lombok.RequiredArgsConstructor; | 23 | import lombok.RequiredArgsConstructor; |
| 24 | import lombok.extern.slf4j.Slf4j; | 24 | import lombok.extern.slf4j.Slf4j; |
| 25 | import org.springframework.beans.factory.annotation.Autowired; | 25 | import org.springframework.beans.factory.annotation.Autowired; |
| 26 | -import org.springframework.beans.factory.annotation.Value; | ||
| 27 | import org.springframework.http.HttpEntity; | 26 | import org.springframework.http.HttpEntity; |
| 28 | import org.springframework.http.HttpHeaders; | 27 | import org.springframework.http.HttpHeaders; |
| 29 | import org.springframework.http.HttpMethod; | 28 | import org.springframework.http.HttpMethod; |
| ... | @@ -47,9 +46,8 @@ public class PayServiceClient { | ... | @@ -47,9 +46,8 @@ public class PayServiceClient { |
| 47 | private final BusinessConfig businessConfig; | 46 | private final BusinessConfig businessConfig; |
| 48 | 47 | ||
| 49 | private final OrderServiceRpcClient orderServiceRpcClient; | 48 | private final OrderServiceRpcClient orderServiceRpcClient; |
| 49 | + | ||
| 50 | private final XmlMapper xmlMapper = new XmlMapper(); | 50 | private final XmlMapper xmlMapper = new XmlMapper(); |
| 51 | - @Value("${payment.client-id:Order0001}") | ||
| 52 | - private String clientId; | ||
| 53 | 51 | ||
| 54 | public PayResponseDto payInform(PayInformRequestDto payRequestDto) { | 52 | public PayResponseDto payInform(PayInformRequestDto payRequestDto) { |
| 55 | final var orderById = orderServiceRpcClient.getOrderById(Integer.valueOf(payRequestDto.getOrderId())); | 53 | final var orderById = orderServiceRpcClient.getOrderById(Integer.valueOf(payRequestDto.getOrderId())); |
| ... | @@ -57,7 +55,7 @@ public class PayServiceClient { | ... | @@ -57,7 +55,7 @@ public class PayServiceClient { |
| 57 | log.info("Order {} not found or canceled, skipping.", payRequestDto.getOrderId()); | 55 | log.info("Order {} not found or canceled, skipping.", payRequestDto.getOrderId()); |
| 58 | throw ClientEndExceptions.BusinessException.build(ErrorCodeEnum.ORDER_CANCEL); | 56 | throw ClientEndExceptions.BusinessException.build(ErrorCodeEnum.ORDER_CANCEL); |
| 59 | } | 57 | } |
| 60 | - String url = businessConfig.getPayUrl(); | 58 | + String url = String.format(businessConfig.getPayUrl(), businessConfig.getPayClientId()); |
| 61 | String requestDate = DateUtil.formatDate(LocalDateTime.now(), DateUtil.YMDHMS); | 59 | String requestDate = DateUtil.formatDate(LocalDateTime.now(), DateUtil.YMDHMS); |
| 62 | ThirdPartyPayInformRequestDto jsonData = buildRequestData(payRequestDto, requestDate); | 60 | ThirdPartyPayInformRequestDto jsonData = buildRequestData(payRequestDto, requestDate); |
| 63 | String jsonDataString; | 61 | String jsonDataString; |
| ... | @@ -79,7 +77,7 @@ public class PayServiceClient { | ... | @@ -79,7 +77,7 @@ public class PayServiceClient { |
| 79 | 77 | ||
| 80 | private ThirdPartyPayInformRequestDto buildRequestData(PayInformRequestDto payRequestDto, String requestDate) { | 78 | private ThirdPartyPayInformRequestDto buildRequestData(PayInformRequestDto payRequestDto, String requestDate) { |
| 81 | ThirdPartyPayInformRequestDto jsonData = new ThirdPartyPayInformRequestDto(); | 79 | ThirdPartyPayInformRequestDto jsonData = new ThirdPartyPayInformRequestDto(); |
| 82 | - jsonData.setClientId(clientId); | 80 | + jsonData.setClientId(businessConfig.getPayClientId()); |
| 83 | jsonData.setTradeId(payRequestDto.getOrderId()); | 81 | jsonData.setTradeId(payRequestDto.getOrderId()); |
| 84 | jsonData.setRequestDate(requestDate); | 82 | jsonData.setRequestDate(requestDate); |
| 85 | jsonData.setRequestSource("OFWXApplet"); | 83 | jsonData.setRequestSource("OFWXApplet"); |
| ... | @@ -89,7 +87,7 @@ public class PayServiceClient { | ... | @@ -89,7 +87,7 @@ public class PayServiceClient { |
| 89 | jsonData.setRemark(""); | 87 | jsonData.setRemark(""); |
| 90 | jsonData.setTransAmount(payRequestDto.getPrice()); | 88 | jsonData.setTransAmount(payRequestDto.getPrice()); |
| 91 | jsonData.setTradeDesc(""); | 89 | jsonData.setTradeDesc(""); |
| 92 | - jsonData.setSign(EncryptionUtil.sha1Encryption(clientId + payRequestDto.getOrderId() + requestDate + clientId)); | 90 | + jsonData.setSign(EncryptionUtil.sha1Encryption(businessConfig.getPayClientId() + payRequestDto.getOrderId() + requestDate + businessConfig.getPayClientId())); |
| 93 | return jsonData; | 91 | return jsonData; |
| 94 | } | 92 | } |
| 95 | 93 | ... | ... |
| ... | @@ -75,7 +75,8 @@ miniprogram.appSecret=5b309517bf918abf760b2195e91b99f3 | ... | @@ -75,7 +75,8 @@ miniprogram.appSecret=5b309517bf918abf760b2195e91b99f3 |
| 75 | 75 | ||
| 76 | business-config.hisCustomerQueryUrl = https://nutri.amcare.com.cn/v3/hiscustomers/current/query | 76 | business-config.hisCustomerQueryUrl = https://nutri.amcare.com.cn/v3/hiscustomers/current/query |
| 77 | business-config.clientCustomerQueryUrl = https://nutri.amcare.com.cn/v3/clientcustomers/current/query | 77 | business-config.clientCustomerQueryUrl = https://nutri.amcare.com.cn/v3/clientcustomers/current/query |
| 78 | -business-config.payUrl = http://10.2.5.162:21051/API/Microapp/CreateOrder?appid=Order0001 | 78 | +business-config.payUrl = http://10.2.5.162:21051/API/Microapp/CreateOrder?appid={0} |
| 79 | +business-config.payClientId = Order | ||
| 79 | 80 | ||
| 80 | ##Actuator\u914D\u7F6E | 81 | ##Actuator\u914D\u7F6E |
| 81 | management.server.port=8088 | 82 | management.server.port=8088 | ... | ... |
-
Please register or login to post a comment