代码清理,okhttp日志开关配置

This commit is contained in:
ZZ 2021-10-14 14:01:36 +08:00
parent 44c8dc6209
commit 4b1c6ea5c6
7 changed files with 12 additions and 34 deletions

View File

@ -37,10 +37,8 @@ import static com.xhpc.evcs.config.EvcsFilter.encryptReqOut;
@Slf4j
public class CoreDispatcher {
@Value("http://hlht.cd-test.zcsy-inc.cn/evcs/20160701")
private String evcsSrvUrl;
@Value("true")
private boolean oklog = false;
@Value("${xhpc.evcs.oklog:true}")
private boolean oklog;
@Autowired
private AuthSecretTokenRepository authSecretTokenRepository;
public static final okhttp3.MediaType JSON = okhttp3.MediaType.parse("application/json; charset=utf-8");
@ -49,10 +47,10 @@ public class CoreDispatcher {
public String ok(Object object, String url, String operatorId3irdpty, String operatorID) {
okhttp3.RequestBody body = null;
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (oklog) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.addInterceptor(logging);
}
builder.connectTimeout(10, TimeUnit.SECONDS)

View File

@ -1,23 +0,0 @@
package com.xhpc.evcs.cd;
import com.xhpc.evcs.api.CoreDispatcher;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@Slf4j
public abstract class CDCoreDispatcher extends CoreDispatcher {
@Value("${xhpc.evcs.cdevcs.srv.url}")
public String evcsSrvUrl;
public String getEvcsSrvUrl() {
return evcsSrvUrl;
}
public void setEvcsSrvUrl(String evcsSrvUrl) {
this.evcsSrvUrl = evcsSrvUrl;
}
}

View File

@ -1,5 +1,6 @@
package com.xhpc.evcs.cd;
import com.xhpc.evcs.api.CoreDispatcher;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.evcs.domain.XhpcStatisticsTimeInterval;
import com.xhpc.evcs.domain.AuthSecretToken;
@ -27,7 +28,7 @@ import static com.xhpc.evcs.cd.NotificationEquipChargeStatusTask.transferInterne
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
@Component
public class NotificationChargeOrderInfo4BonusTask extends CDCoreDispatcher {
public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
@Autowired
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;

View File

@ -3,6 +3,7 @@ package com.xhpc.evcs.cd;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import com.xhpc.common.data.redis.CacheRateModel;
import com.xhpc.evcs.api.CoreDispatcher;
import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
@ -26,7 +27,7 @@ import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
import static com.xhpc.evcs.utils.DateUtil.DATE_FORMAT_DATE_TIME;
@Component
public class NotificationEquipChargeStatusTask extends CDCoreDispatcher {
public class NotificationEquipChargeStatusTask extends CoreDispatcher {
@Autowired
private AuthSecretTokenRepository authSecretTokenRepository;

View File

@ -1,6 +1,7 @@
package com.xhpc.evcs.cd;
import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.evcs.api.CoreDispatcher;
import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
@ -21,7 +22,7 @@ import static com.xhpc.evcs.dto.ConnectorStatusInfo.*;
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
@Component
public class NotificationStationStatusTask extends CDCoreDispatcher {
public class NotificationStationStatusTask extends CoreDispatcher {
@Autowired
private AuthSecretTokenRepository authSecretTokenRepository;

View File

@ -52,7 +52,7 @@ public class EvcsFilter extends OncePerRequestFilter {
@Resource
private AuthSecretTokenRepository authSecretTokenRepository;
@Value("${xhpc.evcs.encrypt:false}")
private boolean encrypt = false;
private boolean encrypt;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {

View File

@ -20,7 +20,7 @@
<spring-boot.version>2.5.1</spring-boot.version>
<spring-cloud.version>2020.0.3</spring-cloud.version>
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
<alibaba.nacos.version>1.1.0</alibaba.nacos.version>
<alibaba.nacos.version>2.0.2</alibaba.nacos.version>
<spring-boot-admin.version>2.4.1</spring-boot-admin.version>
<spring-boot.mybatis>2.1.4</spring-boot.mybatis>
<swagger.fox.version>3.0.0</swagger.fox.version>