zhuyifan

升级

......@@ -2,9 +2,9 @@ plugins {
id 'java'
id 'idea'
id 'application'
id 'org.springframework.boot' version '2.3.3.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'com.google.protobuf' version '0.9.3'
id 'org.springframework.boot' version '2.5.12'
id 'io.spring.dependency-management' version '1.1.6'
id 'com.google.protobuf' version '0.9.4'
}
repositories {
......@@ -21,8 +21,8 @@ application {
}
ext {
grpcVersion = '1.39.0'
protobufVersion = '3.17.2'
grpcVersion = '1.62.2'
protobufVersion = '3.25.3'
}
dependencies {
......@@ -67,20 +67,13 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
static def isAppleSilicon() {
// 检测 macOS 并且使用的是 Apple Silicon 架构
return System.getProperty('os.name').toLowerCase().contains('mac') && System.getProperty('os.arch').equals('aarch64')
}
def protocPlatform = isAppleSilicon() ? ':osx-x86_64' : '';
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protobufVersion}${protocPlatform}"
artifact = "com.google.protobuf:protoc:${protobufVersion}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}${protocPlatform}"
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
......@@ -100,6 +93,13 @@ tasks.withType(JavaCompile).configureEach {
it.options.fork = true
}
tasks {
compileJava {
dependsOn generateProto
source fileTree('build/generated/source/proto/main/java')
}
}
sourceSets {
main {
......
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx3096m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.incremental=true
org.gradle.configureondemand=true
org.gradle.java.home=/usr/lib/jvm/java-11-openjdk-amd64
\ No newline at end of file
org.gradle.configuration-cache=true
\ No newline at end of file
......
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-6.9-bin.zip
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.11-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#org.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
\ No newline at end of file
......
......@@ -68,7 +68,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
public void addCorsMappings(CorsRegistry registry) {
// 跨域支持
registry.addMapping("/**")
.allowedOrigins("*")
.allowedOriginPatterns("*")
.allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.PUT.name(), HttpMethod.DELETE.name(), HttpMethod.PATCH.name(), HttpMethod.OPTIONS.name())
.allowCredentials(true);
}
......
......@@ -23,7 +23,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -33,7 +33,7 @@ import java.io.IOException;
@Component
@SuppressWarnings("all")
@RequiredArgsConstructor
public class LoginInterceptor extends HandlerInterceptorAdapter {
public class LoginInterceptor implements HandlerInterceptor {
private final ClientCustomerServiceRpcClient clientCustomerServiceRpcClient;
private final MeiZhongYiHeServiceClient meiZhongYiHeServiceClient;
......
......@@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.infoloop.tianting.clientcustomerorderservice.ClientCustomerOrderModification;
import com.infoloop.tianting.clientcustomerorderservice.OnlinePayEnum;
......@@ -36,7 +36,6 @@ import com.infoloop.tianting.utils.EncryptionUtil;
import com.infoloop.tianting.utils.JsonUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -78,8 +77,6 @@ public class PayServiceClient {
private final XmlMapper xmlMapper = new XmlMapper();
private final OkHttpClient client = new OkHttpClient();
public PayResponseDto payInform(PayInformRequestDto payRequestDto) {
final var orderById =
orderServiceRpcClient.getOrderById(Integer.valueOf(payRequestDto.getOrderId()));
......@@ -97,7 +94,7 @@ public class PayServiceClient {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE);
objectMapper.setPropertyNamingStrategy(new PropertyNamingStrategies.UpperCamelCaseStrategy());
jsonDataString = objectMapper.writeValueAsString(jsonData);
} catch (JsonProcessingException e) {
log.error("Failed to serialize request data", e);
......@@ -354,7 +351,6 @@ public class PayServiceClient {
+ "^"
+ "01"
+ "^"
+ ""
+ "^"
+ orderById.getOpenId()
+ "^"
......@@ -368,7 +364,6 @@ public class PayServiceClient {
+ "^"
+ payRefundRequestDto.getHospitalCode()
+ "^"
+ ""
+ "^"
+ LoginContextHolder.getId()
+ "^"
......@@ -384,7 +379,7 @@ public class PayServiceClient {
// 构建请求
try {
String url = businessConfig.getCancelPayUrl() + "?" + "appid=" + appId + "&paycontent=" + payContent + "&signinfo=" + signInfo;
log.info("cancel order pay url:" + url);
log.info("cancel order pay url:{}", url);
// Request request =
// new Request.Builder().url(url).get().build();
// Response payResponse = client.newCall(request).execute();
......