调整核心平台登陆为每20分钟refresh
diff --git a/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java b/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java
index 4be6e83..4dfdb96 100644
--- a/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java
+++ b/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java
@@ -61,10 +61,6 @@
private static final String impcustomeFirstTime = "IMPCUSTOME_FIRST_TIME";
- private static final String payapiAppid = "PAYAPI_APPID";
-
- private static final String payapiSecret = "PAYAPI_SECRET";
-
protected static Logger logger = LoggerFactory.getLogger(DoorlistMgrController.class);
@Autowired
@@ -352,9 +348,6 @@
@Autowired
- private ApiLoginProxy apiLoginProxy;
-
- @Autowired
private UserProxy userProxy;
@@ -372,12 +365,6 @@
return map;
}
try {
- TSystemParam appidSystemParam = systemService.getSystemParamByKey(payapiAppid);
- String appid = appidSystemParam.getParamValue();
- TSystemParam secretSystemParam = systemService.getSystemParamByKey(payapiSecret);
- String secret = secretSystemParam.getParamValue();
- ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
- helper.login(appid, secret);
String now = DateUtil.getNow();
List<TNcCardlist> tmpNcCardList = new ArrayList<TNcCardlist>();
@@ -407,6 +394,9 @@
if (response.getRetcode() != 0){
errCnt++;
tCustomerNoExistInfos.add(list);
+ if (logger.isInfoEnabled()){
+ logger.info(cardno+"--核心平台验证失败,已统计!");
+ }
continue;
}
if (logger.isInfoEnabled()){
diff --git a/src/main/java/com/supwisdom/dlpay/task/SyncCustomerTask.java b/src/main/java/com/supwisdom/dlpay/task/SyncCustomerTask.java
index e649b63..f9a2a70 100644
--- a/src/main/java/com/supwisdom/dlpay/task/SyncCustomerTask.java
+++ b/src/main/java/com/supwisdom/dlpay/task/SyncCustomerTask.java
@@ -15,6 +15,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@@ -30,7 +32,7 @@
@EnableScheduling // 2.开启定时任务
@EnableFeignClients(basePackages = "com.supwisdom.dlpay.paysdk")
@ComponentScan(basePackages = {"com.supwisdom.dlpay.paysdk"})
-public class SyncCustomerTask {
+public class SyncCustomerTask implements ApplicationRunner {
protected static Logger logger = LoggerFactory.getLogger(SyncCustomerTask.class);
@@ -60,6 +62,46 @@
@Autowired
private UserProxy userProxy;
+ @Override
+ public void run(ApplicationArguments args) throws Exception {
+ logger.info("登陆核心平台");
+ apiLogin();
+ }
+
+
+ private void apiLogin(){
+ try {
+ TSystemParam appidParam = systemService.getSystemParamByKey(payapiAppid);
+ TSystemParam secretParam = systemService.getSystemParamByKey(payapiSecret);
+ if (null==appidParam || null==secretParam){
+ logger.info("核心平台参数配置错误!");
+ return;
+ }
+ String appid = appidParam.getParamValue();
+ String secret = secretParam.getParamValue();
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ helper.login(appid, secret);
+
+ logger.info("登陆核心平台成功!");
+
+ }catch (Exception e){
+ e.printStackTrace();
+ logger.error("登陆核心平台失败!");
+ }
+ }
+
+ @Scheduled(cron = "${apiLogin.refresh.cron}")//每20分钟执行一次
+ private void apiLoginRefresh(){
+ try {
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ helper.refresh();
+ logger.info("刷新登录状态成功!");
+ }catch (Exception e){
+ e.printStackTrace();
+ logger.error("刷新登陆状态失败!");
+ }
+ }
+
@Scheduled(cron = "${sync.cardStatus.cron}")//十分钟执行一次
private void getCardStatusChangeTask(){
String startTime = "";
@@ -82,14 +124,6 @@
TSystemParam lastSyncTimeParam = systemService.getSystemParamByKey(lastSyncTime);
startTime = lastSyncTimeParam.getParamValue();
}
- //2.登陆核心平台
- ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
- TSystemParam appidSystemParam = systemService.getSystemParamByKey(payapiAppid);
- String appid = appidSystemParam.getParamValue();
- TSystemParam secretSystemParam = systemService.getSystemParamByKey(payapiSecret);
- String secret = secretSystemParam.getParamValue();
- helper.login(appid, secret);
-
QueryCardsParam param = new QueryCardsParam();
param.setStarttime(startTime);
@@ -126,7 +160,10 @@
}
}catch (Exception e){
+ e.printStackTrace();
logger.error(e.getMessage());
}
}
+
+
}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 09f23c0..5f23126 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -43,6 +43,7 @@
## quartz task scheduler
sync.cardStatus.cron=0 0/10 * * * ?
+apiLogin.refresh.cron=0 0/20 * * * ?
spring.redis.database=2