zhuyifan

fix

......@@ -15,4 +15,5 @@ public class BusinessConfig {
private String hisCustomerQueryUrl;
private String clientCustomerQueryUrl;
private String payUrl;
private String payClientId;
}
......
......@@ -23,7 +23,6 @@ import com.infoloop.tianting.utils.EncryptionUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
......@@ -47,9 +46,8 @@ public class PayServiceClient {
private final BusinessConfig businessConfig;
private final OrderServiceRpcClient orderServiceRpcClient;
private final XmlMapper xmlMapper = new XmlMapper();
@Value("${payment.client-id:Order0001}")
private String clientId;
public PayResponseDto payInform(PayInformRequestDto payRequestDto) {
final var orderById = orderServiceRpcClient.getOrderById(Integer.valueOf(payRequestDto.getOrderId()));
......@@ -57,7 +55,7 @@ public class PayServiceClient {
log.info("Order {} not found or canceled, skipping.", payRequestDto.getOrderId());
throw ClientEndExceptions.BusinessException.build(ErrorCodeEnum.ORDER_CANCEL);
}
String url = businessConfig.getPayUrl();
String url = String.format(businessConfig.getPayUrl(), businessConfig.getPayClientId());
String requestDate = DateUtil.formatDate(LocalDateTime.now(), DateUtil.YMDHMS);
ThirdPartyPayInformRequestDto jsonData = buildRequestData(payRequestDto, requestDate);
String jsonDataString;
......@@ -79,7 +77,7 @@ public class PayServiceClient {
private ThirdPartyPayInformRequestDto buildRequestData(PayInformRequestDto payRequestDto, String requestDate) {
ThirdPartyPayInformRequestDto jsonData = new ThirdPartyPayInformRequestDto();
jsonData.setClientId(clientId);
jsonData.setClientId(businessConfig.getPayClientId());
jsonData.setTradeId(payRequestDto.getOrderId());
jsonData.setRequestDate(requestDate);
jsonData.setRequestSource("OFWXApplet");
......@@ -89,7 +87,7 @@ public class PayServiceClient {
jsonData.setRemark("");
jsonData.setTransAmount(payRequestDto.getPrice());
jsonData.setTradeDesc("");
jsonData.setSign(EncryptionUtil.sha1Encryption(clientId + payRequestDto.getOrderId() + requestDate + clientId));
jsonData.setSign(EncryptionUtil.sha1Encryption(businessConfig.getPayClientId() + payRequestDto.getOrderId() + requestDate + businessConfig.getPayClientId()));
return jsonData;
}
......
......@@ -75,7 +75,8 @@ miniprogram.appSecret=5b309517bf918abf760b2195e91b99f3
business-config.hisCustomerQueryUrl = https://nutri.amcare.com.cn/v3/hiscustomers/current/query
business-config.clientCustomerQueryUrl = https://nutri.amcare.com.cn/v3/clientcustomers/current/query
business-config.payUrl = http://10.2.5.162:21051/API/Microapp/CreateOrder?appid=Order0001
business-config.payUrl = http://10.2.5.162:21051/API/Microapp/CreateOrder?appid={0}
business-config.payClientId = Order
##Actuator\u914D\u7F6E
management.server.port=8088
......