|
|
@@ -17,18 +17,13 @@ import com.kym.service.enplus.EnPlusService;
|
|
|
import okhttp3.*;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.yaml.snakeyaml.Yaml;
|
|
|
|
|
|
-import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
-import java.io.InputStream;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
@@ -42,21 +37,22 @@ public class EnPlusServiceImpl implements EnPlusService {
|
|
|
public static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(EnPlusServiceImpl.class);
|
|
|
static OkHttpClient HTTP_CLIENT = new OkHttpClient.Builder().build();
|
|
|
+ private final RedisTemplate<String, String> redisTemplate;
|
|
|
+ @Lazy
|
|
|
+ private final EnPlusServiceHelper enPlusServiceHelper;
|
|
|
@Value("${en-plus.operatorId}")
|
|
|
private String OperatorId;
|
|
|
@Value("${en-plus.operatorSecret}")
|
|
|
private String OperatorSecret;
|
|
|
@Value("${en-plus.sigSecret}")
|
|
|
private String SigSecret;
|
|
|
- @Autowired
|
|
|
- private RedisTemplate<String, String> redisTemplate;
|
|
|
|
|
|
- @Autowired
|
|
|
- @Lazy
|
|
|
- private EnPlusServiceHelper enPlusServiceHelper;
|
|
|
+ public EnPlusServiceImpl(RedisTemplate<String, String> redisTemplate, EnPlusServiceHelper enPlusServiceHelper) {
|
|
|
+ this.redisTemplate = redisTemplate;
|
|
|
+ this.enPlusServiceHelper = enPlusServiceHelper;
|
|
|
+ }
|
|
|
|
|
|
public static <T> T parse(String json, Class<T> clz) {
|
|
|
- // TODO: 2023-08-01 json异常处理
|
|
|
return JSONObject.parseObject(json, clz);
|
|
|
}
|
|
|
|